Class BackpackLoadout
- java.lang.Object
-
- org.rspeer.game.config.item.loadout.BackpackLoadout
-
- All Implemented Interfaces:
Cloneable,Iterable<ItemEntry>,InventoryLoadout
public class BackpackLoadout extends Object implements InventoryLoadout
-
-
Constructor Summary
Constructors Constructor Description BackpackLoadout(String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(ItemEntry entry)Adds anItemEntryto the loadoutvoidadd(BackpackLoadout other)Appends a loadout to this loadoutvoidadd(EquipmentLoadout other)Appends anEquipmentLoadoutto this loadout.static BackpackLoadoutbagged(String name)BackpackLoadoutclone()BackpackLoadoutclone(String name)ItemEntryget(String key)intgetActionsPerTick()intgetAllocated()StringgetName()Consumer<ItemEntry>getOutOfItemListener()intgetSlotCount(ItemEntry entry)Iterator<ItemEntry>iterator()ItemEntryremove(String key)voidsetEntries(Map<String,ItemEntry> entries)voidsetOutOfItemListener(Consumer<ItemEntry> outOfItemListener)booleanwithdraw()booleanwithdraw(Bank bank)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.rspeer.game.config.item.loadout.InventoryLoadout
applyProvidedSetup, getExcessBackpackEntries, getExcessEntries, getExcessEquipmentEntries, getExcessItems, getInvalidBackpackItems, getInvalidEquipmentItems, getInvalidItems, getIrrelevantItems, getMissing, getMissingBackpackEntries, getMissingBackpackEntries, getMissingEntries, getMissingEntries, getMissingEntries, getMissingEntries, getMissingEquipmentEntries, getMissingEquipmentEntries, getValidBackpackResults, getValidEquipmentResults, getValidResults, isBackpackValid, isBackpackValid, isBagged, isBagged, isEquipmentValid, isEquipmentValid, isInventoryValid, isInventoryValid
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
BackpackLoadout
public BackpackLoadout(String name)
-
-
Method Detail
-
bagged
public static BackpackLoadout bagged(String name)
-
getActionsPerTick
public int getActionsPerTick()
-
withdraw
public boolean withdraw(Bank bank)
- Returns:
- Withdraws this loadout from the bank. Returns true if the full withdraw was completed, false if it failed or requires another tick to complete the full withdrawal. If an entry is unavailable and not optional, it will call the outOfItemListener. Will call the out of item listener if there are none left in the bank, regardless of if you have it in the inventory
- See Also:
setOutOfItemListener(Consumer),getOutOfItemListener()
-
withdraw
public boolean withdraw()
- Specified by:
withdrawin interfaceInventoryLoadout
-
getAllocated
public int getAllocated()
-
getSlotCount
public int getSlotCount(ItemEntry entry)
-
getName
public String getName()
- Specified by:
getNamein interfaceInventoryLoadout- Returns:
- The name of this loadout
-
get
public ItemEntry get(String key)
- Specified by:
getin interfaceInventoryLoadout- Returns:
- An
ItemEntrywith the given key
-
add
public boolean add(ItemEntry entry)
Description copied from interface:InventoryLoadoutAdds anItemEntryto the loadout- Specified by:
addin interfaceInventoryLoadout- Returns:
trueif an item was successfully added to the loadout
-
remove
public ItemEntry remove(String key)
- Specified by:
removein interfaceInventoryLoadout- Returns:
- The removed entry, or null if no ItemEntry matching the key was present
-
getOutOfItemListener
public Consumer<ItemEntry> getOutOfItemListener()
- Specified by:
getOutOfItemListenerin interfaceInventoryLoadout
-
setOutOfItemListener
public void setOutOfItemListener(Consumer<ItemEntry> outOfItemListener)
- Specified by:
setOutOfItemListenerin interfaceInventoryLoadout
-
clone
public BackpackLoadout clone(String name)
- Specified by:
clonein interfaceInventoryLoadout
-
add
public void add(BackpackLoadout other)
Appends a loadout to this loadout- Parameters:
other- The loadout to add
-
add
public void add(EquipmentLoadout other)
Appends anEquipmentLoadoutto this loadout. Note that it will skip over items you have equipped already. If you don't want to skip these, then useadd(BackpackLoadout)withEquipmentLoadout.toBackpackLoadout(String)as the arg- Parameters:
other- The loadout to add
-
clone
public BackpackLoadout clone()
- Specified by:
clonein interfaceInventoryLoadout
-
-