Class Bank
- java.lang.Object
-
- org.dreambot.api.methods.container.impl.bank.Bank
-
public class Bank extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
addToBankHistoryCache(Item item)
This allows you to add an item to the bank history cache, it should only be necessary if you're doing things outside of our APIstatic java.util.List<Item>
all()
Gets the items in your bankstatic java.util.List<Item>
all(Filter<Item> filter)
A list of all the items that match the given filterstatic int
availableTabs()
Gets the number of tabs currently availablestatic java.awt.Rectangle
calculateSlotPosition(int slot)
Gets the virtual position for the specified slot.static int
capacity()
static boolean
close()
Exits the bank with the close button.static boolean
contains(int id)
Checks if the bank contains the given IDstatic boolean
contains(int[] ids)
static boolean
contains(java.lang.Integer... ids)
Checks if your collection contains one item which meets one of the specified ids.static boolean
contains(java.lang.Object o)
Checks to see if the bank contains an item matching the given Objectstatic boolean
contains(java.lang.String string)
Determines if bank contains an item that matches the given name.static boolean
contains(java.lang.String... names)
Checks if your collection contains one item which meets one of the specified names.static boolean
contains(Filter<Item> filter)
Checks if your collection contains one item which meets the specified filter.static boolean
containsAll(int[] ids)
Checks if your Bank contains all of the items with specified IDsstatic boolean
containsAll(java.lang.Integer... ids)
Checks if your Bank contains all of the items with specified IDsstatic boolean
containsAll(java.lang.String... names)
Checks if your Bank contains all of the items with names specifiedstatic boolean
containsAll(java.util.Collection<?> collection)
Checks if your bank contains all of the items in the collectionsstatic int
count(int id)
Count of all the items that match the search.static int
count(int[] ids)
static int
count(java.lang.Integer... ids)
Count of all the items that match the search.static int
count(java.lang.String name)
Count of all the items that match the search.static int
count(java.lang.String... names)
Count of all the items that match the search.static int
count(BankTab tab)
Gets the Item count for the BankTabstatic int
count(Filter<Item> filter)
Count of all the items that match the search.static boolean
deposit(int id)
static boolean
deposit(int id, int amount)
static boolean
deposit(java.lang.String name)
static boolean
deposit(java.lang.String name, int amount)
static boolean
deposit(Filter<Item> filter)
static boolean
deposit(Filter<Item> filter, int amount)
Deposits the item specified by the item id and amount.static boolean
deposit(Item item)
static boolean
deposit(Item item, int amount)
static boolean
depositAll(int id)
static boolean
depositAll(java.lang.String name)
static boolean
depositAll(Filter<Item> filter)
static boolean
depositAll(Item item)
static boolean
depositAllEquipment()
Deposits all worn equipment with the deposit all equipment button.static boolean
depositAllExcept(int[] ids)
static boolean
depositAllExcept(java.lang.Integer... ids)
static boolean
depositAllExcept(java.lang.String... names)
static boolean
depositAllExcept(Filter<Item> filter)
static boolean
depositAllItems()
Deposits all items in your inventory with the deposit all button.static boolean
drag(int fromSlot, int toSlot)
Drags the item from one slot to another, either of which can be empty to simply move an item from one slot to the otherstatic int
emptySlotCount()
Empty slot count.static java.util.List<Item>
except(Filter<Item> filter)
Get all items which do not fit the given criteria.static int
fullSlotCount()
Full slot count.static Item
get(int id)
Gets the first item with the given idstatic Item
get(int[] ids)
Seeget(Integer...)
static Item
get(java.lang.Integer... ids)
Gets the first Item that matches one of the given idsstatic Item
get(java.lang.String name)
Get the item for specified name.static Item
get(java.lang.String... names)
Gets the first item that matches one of the given namesstatic Item
get(Filter<Item> filter)
static java.util.List<Item>
getBankHistoryCache()
Gets the bank item history cache.static WidgetChild
getChild(int id)
Gets the WidgetChild of the Itemstatic WidgetChild
getChild(java.lang.String name)
Gets the WidgetChild of the Itemstatic WidgetChild
getChild(Filter<Item> filter)
Gets the WidgetChild of the Itemstatic WidgetChild
getChild(Item item)
Gets the WidgetChild of the Itemstatic WidgetChild
getChildForSlot(int slot)
Gets the WidgetChild for the given slotstatic Entity
getClosestBank(BankType type)
Gets the nearest bank interactable based on BankTypestatic BankLocation
getClosestBankLocation()
Get closest bank location.static BankTab
getCurrentBankTab()
Gets the current BankTabstatic int
getCurrentTab()
Gets the current tab that is openstatic BankQuantitySelection
getDefaultQuantity()
static int
getFirstEmptySlot()
Gets the first empty slot in the bank.static int
getFirstFullSlot()
Gets the next full slot in your bankstatic int
getIdForSlot(int slot)
Gets the Id of the Item in the slot.static Item
getItemInSlot(int slot)
Gets item in specified slot.static long
getLastBankHistoryCacheTime()
Returns the last timestamp (using System#currentTimeMillis) of a cache updatestatic java.lang.String
getNameForSlot(int slot)
Gets the Name for the Item in the slot.static BankMode
getRearrangeMode()
Gets the current rearrange mode type;static int
getRow(Item item)
Gets the row of the Itemstatic int
getScrollHeight()
Determines the current scroll position height of the bank's scroll container.static int
getTab(Item item)
Gets the tab for the itemstatic BankMode
getWithdrawMode()
Gets the current withdraw mode.static boolean
isAlwaysOpenTab()
static boolean
isEmpty()
static boolean
isFull()
Determines if bank is full.static boolean
isLoaded()
static boolean
isOpen()
Checks if the bank is currently open or not.static boolean
isSlotEmpty(int slot)
static boolean
isSlotFull(int slot)
Checks if the slot has an Item in itstatic boolean
isSlotVisible(Item item)
Determines whether or not offset specific slot is visible, defined by the item.static boolean
needToScroll(Item item)
Determines if the bot needs to scroll to find offset slot.static boolean
needToScrollDown(Item item)
Determines whether or not the bot should scroll down to find the slot given.static boolean
needToScrollUp(Item item)
Determines whether or not the bot should scroll up to find the slot given.static boolean
onlyContains(int[] ids)
static boolean
onlyContains(java.lang.Integer... ids)
Checks if your Bank only contains items with specified IDstatic boolean
onlyContains(java.lang.String... names)
Checks if your Bank only contains items with specified namestatic boolean
onlyContains(Filter<Item> f)
Checks if your Bank only contains items that match the Filterstatic boolean
open()
Finds the nearest BankType and attempts to open it.static boolean
open(BankLocation bank)
Opens a specific bank location, if you're not in the area it will call walk(Tile) and return false If given a null bank location, it will verify the nearest bank type's location (if we have it) If that verification fails, it will recalculate to find the nearest valid bank location.static boolean
openTab(int tab)
Opens the bank tab specifiedstatic boolean
openTab(BankTab tab)
Opens the BankTab specified.static boolean
placeHoldersEnabled()
static void
resetCache()
This will reset the bank history cache to it's initial statestatic boolean
scroll(int id)
Scrolls to the item which matches the given filter.static boolean
scroll(int id, BankScroll type)
Scrolls to the item which matches the given filter.static boolean
scroll(java.lang.String name)
Scrolls to the item which matches the given filter.static boolean
scroll(java.lang.String name, BankScroll type)
Scrolls to the item which matches the given filter.static boolean
scroll(Filter<Item> filter)
Scrolls to the item which matches the given filter.static boolean
scroll(Filter<Item> filter, BankScroll type)
Scrolls to the item which matches the given filter.static Item
set(int index, Item element)
static void
setAlwaysOpenTab(boolean alwaysOpenTab)
static boolean
setDefaultQuantity(BankQuantitySelection selection)
static boolean
setRearrangeMode(BankMode mode)
Sets the Rearrange mode for the bank.static void
setUseBankHistoryCache(boolean useCache)
Set whether our methods use the Bank cache if you call a method while not in the bankstatic boolean
setWithdrawMode(BankMode mode)
Sets the withdraw modestatic int
size()
static int
slot(int id)
Gets the slot for the item with specified ID.static int
slot(java.lang.String name)
Gets the slot for the item with specified name.static int
slot(Filter<Item> filter)
Gets the slot for the first item that matches the given filterstatic java.awt.Rectangle
slotBounds(int slot)
Gets the bounds of a slotstatic java.awt.Rectangle
slotBounds(Item item)
Gets the bounds of a slotstatic boolean
slotContains(int slot, int[] ids)
static boolean
slotContains(int slot, java.lang.Integer... ids)
Checks if the slot contains an item with an ID matching one of the given idsstatic boolean
slotContains(int slot, java.lang.String... names)
Checks if the slot contains items that matches the given names.static boolean
slotContains(int slot, Filter<Item> filter)
Checks if the slot contains an item that matches the filter.static boolean
slotContains(int slot, Item t)
Checks if the slot contains items that matches the given ids.static boolean
slotNameContains(int slot, java.lang.String sub)
Checks if the slot contains items that matches the given ids.static int
tabContainerWidgetId()
static boolean
togglePlaceholders(boolean enabled)
static void
updateCache()
Used for updating the bank cache, generally reserved for internal use but can be called in a script during custom banking This will clear the bank cache and update it with all bank itemsstatic void
updateCache(java.util.Collection<Item> items)
Clears the bank history cache and fills it with the given collection of items, only works if bank is openstatic int
widgetChildId()
static int
widgetParentId()
static boolean
withdraw(int id)
Withdraws an item for the id and amount given.static boolean
withdraw(int id, int amount)
Withdraws an item for the id and amount given.static boolean
withdraw(java.lang.String name)
Withdraws an item for the id and amount given.static boolean
withdraw(java.lang.String name, int amount)
Withdraws an item for the id and amount given.static boolean
withdraw(Filter<Item> filter)
Withdraws an item for the id and amount given.static boolean
withdraw(Filter<Item> filter, int amount)
Withdraws an item for the id and amount given.static boolean
withdrawAll(int id)
Withdraws all of a item for the id and amount given.static boolean
withdrawAll(java.lang.String name)
Withdraws all of a item for the name and amount given.static boolean
withdrawAll(Filter<Item> filter)
Withdraws all items for the id given.
-
-
-
Method Detail
-
widgetParentId
public static int widgetParentId()
-
widgetChildId
public static int widgetChildId()
-
tabContainerWidgetId
public static int tabContainerWidgetId()
-
capacity
public static int capacity()
-
setUseBankHistoryCache
public static void setUseBankHistoryCache(boolean useCache)
Set whether our methods use the Bank cache if you call a method while not in the bank- Parameters:
useCache
- true (default) if you want to use the cache if available, false otherwise
-
all
public static java.util.List<Item> all()
Gets the items in your bank- Returns:
- list of all items in your bank.
-
isLoaded
public static boolean isLoaded()
-
calculateSlotPosition
public static java.awt.Rectangle calculateSlotPosition(int slot)
Gets the virtual position for the specified slot.- Parameters:
slot
- The slot to find the position for.- Returns:
- The rectangle object of the slot.
-
resetCache
public static void resetCache()
This will reset the bank history cache to it's initial state
-
isOpen
public static boolean isOpen()
Checks if the bank is currently open or not.- Returns:
- True if bank interface is open, else False
-
getClosestBank
public static Entity getClosestBank(BankType type)
Gets the nearest bank interactable based on BankType- Parameters:
type
- bank type to look for- Returns:
- entity of closest bank object
-
open
public static boolean open()
Finds the nearest BankType and attempts to open it. This method will walk to the nearest available BankLocation (getClosestBankLocation()
) if there isn't a local bank entity.- Returns:
- true if the bank opens successfully, otherwise false
-
open
public static boolean open(BankLocation bank)
Opens a specific bank location, if you're not in the area it will call walk(Tile) and return false If given a null bank location, it will verify the nearest bank type's location (if we have it) If that verification fails, it will recalculate to find the nearest valid bank location.- Parameters:
bank
- BankLocation that you want to open/go to, give null if you want it to just find the nearest loaded BankType- Returns:
- True if opens successfully, else false
-
getClosestBankLocation
public static BankLocation getClosestBankLocation()
Get closest bank location.- Returns:
- the bank location closest to your player.
-
withdraw
public static boolean withdraw(int id)
Withdraws an item for the id and amount given.- Parameters:
id
- The id of the item to withdraw.- Returns:
- True if interaction was successful, else False
-
withdrawAll
public static boolean withdrawAll(int id)
Withdraws all of a item for the id and amount given.- Parameters:
id
- The id of the item to withdraw.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(int id, int amount)
Withdraws an item for the id and amount given.- Parameters:
id
- The id of the item to withdraw.amount
- The amount to withdraw.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(java.lang.String name)
Withdraws an item for the id and amount given.- Parameters:
name
- The name of the item to withdraw.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(java.lang.String name, int amount)
Withdraws an item for the id and amount given.- Parameters:
name
- The name of the item to withdraw.amount
- The amount to withdraw.- Returns:
- True if interaction was successful, else False
-
withdrawAll
public static boolean withdrawAll(java.lang.String name)
Withdraws all of a item for the name and amount given.- Parameters:
name
- The name of the item to withdraw.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(Filter<Item> filter)
Withdraws an item for the id and amount given.- Parameters:
filter
- The item id of the item to withdraw.- Returns:
- True if interaction was successful, else False
-
withdrawAll
public static boolean withdrawAll(Filter<Item> filter)
Withdraws all items for the id given.- Parameters:
filter
- The item id of the item to withdraw.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(Filter<Item> filter, int amount)
Withdraws an item for the id and amount given.- Parameters:
filter
- The item id of the item to withdraw.amount
- The amount to withdraw.- Returns:
- True if interaction was successful, else False
-
depositAllItems
public static boolean depositAllItems()
Deposits all items in your inventory with the deposit all button.
-
depositAllEquipment
public static boolean depositAllEquipment()
Deposits all worn equipment with the deposit all equipment button.
-
deposit
public static boolean deposit(Filter<Item> filter, int amount)
Deposits the item specified by the item id and amount.- Parameters:
filter
- The item id of the item to withdraw.amount
- The amount of the item to deposit.- Returns:
- True if deposit success, else False
-
close
public static boolean close()
Exits the bank with the close button.- Returns:
- True if bank is not open, else False
-
getCurrentTab
public static int getCurrentTab()
Gets the current tab that is open- Returns:
- Integer value of the current tab, -1 if one isn't open or found
-
slotBounds
public static java.awt.Rectangle slotBounds(int slot)
Gets the bounds of a slot- Parameters:
slot
- Slot to get bounds of- Returns:
- Rectangle of the slot
-
slotBounds
public static java.awt.Rectangle slotBounds(Item item)
Gets the bounds of a slot- Parameters:
item
- Item to get bounds of- Returns:
- Rectangle of the slot
-
openTab
public static boolean openTab(int tab)
Opens the bank tab specified- Parameters:
tab
- integer value of tab that you want opened- Returns:
- whether tab was successfully opened.
-
openTab
public static boolean openTab(BankTab tab)
Opens the BankTab specified.- Parameters:
tab
- The BankTab to open.- Returns:
- True if BankTab was opened, else false
-
getBankHistoryCache
public static java.util.List<Item> getBankHistoryCache()
Gets the bank item history cache.- Returns:
- list of all your bank items since your last visit.
-
addToBankHistoryCache
public static boolean addToBankHistoryCache(Item item)
This allows you to add an item to the bank history cache, it should only be necessary if you're doing things outside of our API- Parameters:
item
- the item to add to the cache- Returns:
- true if a cache exists and we add the item to it, false otherwise
-
getLastBankHistoryCacheTime
public static long getLastBankHistoryCacheTime()
Returns the last timestamp (using System#currentTimeMillis) of a cache update- Returns:
- timestamp of last cache update, or 0 if the bank cache hasn't been created yet
-
getChild
public static WidgetChild getChild(int id)
Gets the WidgetChild of the Item- Parameters:
id
- the id of the item- Returns:
- WidgetChild of the item
-
getChild
public static WidgetChild getChild(java.lang.String name)
Gets the WidgetChild of the Item- Parameters:
name
- the name of the item- Returns:
- WidgetChild of the item
-
getChild
public static WidgetChild getChild(Filter<Item> filter)
Gets the WidgetChild of the Item- Parameters:
filter
- the filter used to find item.- Returns:
- WidgetChild of the item
-
getChild
public static WidgetChild getChild(Item item)
Gets the WidgetChild of the Item- Parameters:
item
- Item to get the child of- Returns:
- WidgetChild of the item
-
getChildForSlot
public static WidgetChild getChildForSlot(int slot)
Gets the WidgetChild for the given slot- Parameters:
slot
- Bank slot to get the WidgetChild for.- Returns:
- WidgetChild of the slot
-
getRearrangeMode
public static BankMode getRearrangeMode()
Gets the current rearrange mode type;- Returns:
- current rearrange mode wrapped in a @link:"org.dreambot.api.methods.container.impl.bank.BankMode" object.
-
isSlotVisible
public static boolean isSlotVisible(Item item)
Determines whether or not offset specific slot is visible, defined by the item.- Parameters:
item
- The item that the slot you are searching for contains.- Returns:
- Whether or not the specified slot is visible.
-
getWithdrawMode
public static BankMode getWithdrawMode()
Gets the current withdraw mode.- Returns:
- current withdraw mode.
-
setWithdrawMode
public static boolean setWithdrawMode(BankMode mode)
Sets the withdraw mode- Parameters:
mode
- BankMode- Returns:
- True if successfully switched, else false
-
setRearrangeMode
public static boolean setRearrangeMode(BankMode mode)
Sets the Rearrange mode for the bank.- Parameters:
mode
- BankMode- Returns:
- true if successfully switched else false
-
getDefaultQuantity
public static BankQuantitySelection getDefaultQuantity()
-
setDefaultQuantity
public static boolean setDefaultQuantity(BankQuantitySelection selection)
-
placeHoldersEnabled
public static boolean placeHoldersEnabled()
-
togglePlaceholders
public static boolean togglePlaceholders(boolean enabled)
-
needToScrollUp
public static boolean needToScrollUp(Item item)
Determines whether or not the bot should scroll up to find the slot given.- Parameters:
item
- The item that the slot you are searching for contains.- Returns:
- Whether or not the bot should scroll up to find the slot.
-
needToScrollDown
public static boolean needToScrollDown(Item item)
Determines whether or not the bot should scroll down to find the slot given.- Parameters:
item
- The item that the slot you are searching for contains.- Returns:
- Whether or not the bot should scroll down to find the slot.
-
needToScroll
public static boolean needToScroll(Item item)
Determines if the bot needs to scroll to find offset slot.- Parameters:
item
- The item that the slot you are searching for contains.- Returns:
- Whether or not the bot needs to scroll to find the slot.
-
getRow
public static int getRow(Item item)
Gets the row of the Item- Parameters:
item
- Item to find the row of- Returns:
- Integer value of the row of the Item
-
getTab
public static int getTab(Item item)
Gets the tab for the item- Parameters:
item
- Item to get the tab of- Returns:
- Tab of the item
-
availableTabs
public static int availableTabs()
Gets the number of tabs currently available- Returns:
- Integer value of the current amount of tabs available
-
count
public static int count(BankTab tab)
Gets the Item count for the BankTab- Returns:
- Integer value with how many items are in the tab
-
getCurrentBankTab
public static BankTab getCurrentBankTab()
Gets the current BankTab- Returns:
- currently open BankTab, else null
-
getScrollHeight
public static int getScrollHeight()
Determines the current scroll position height of the bank's scroll container.- Returns:
- The current scroll position height of the bank's scroll container.
-
scroll
public static boolean scroll(int id, BankScroll type)
Scrolls to the item which matches the given filter.- Parameters:
id
- the id of the item to scroll to.type
- the method of scrolling you would like to use.- Returns:
- true if the item is visible after scrolling.
-
scroll
public static boolean scroll(int id)
Scrolls to the item which matches the given filter.- Parameters:
id
- the id of the item to scroll to.- Returns:
- true if the item is visible after scrolling.
-
scroll
public static boolean scroll(java.lang.String name, BankScroll type)
Scrolls to the item which matches the given filter.- Parameters:
name
- the name of the item to scroll to.type
- the method of scrolling you would like to use.- Returns:
- true if the item is visible after scrolling.
-
scroll
public static boolean scroll(java.lang.String name)
Scrolls to the item which matches the given filter.- Parameters:
name
- the name of the item to scroll to.- Returns:
- true if the item is visible after scrolling.
-
scroll
public static boolean scroll(Filter<Item> filter)
Scrolls to the item which matches the given filter.- Parameters:
filter
- the filter of the item to scroll to.- Returns:
- true if the item is visible after scrolling.
-
scroll
public static boolean scroll(Filter<Item> filter, BankScroll type)
Scrolls to the item which matches the given filter.- Parameters:
filter
- the filter of the item to scroll to.type
- the method of scrolling you would like to use.- Returns:
- true if the item is visible after scrolling.
-
updateCache
public static void updateCache(java.util.Collection<Item> items)
Clears the bank history cache and fills it with the given collection of items, only works if bank is open- Parameters:
items
- collection of items to fill the bank cache with
-
updateCache
public static void updateCache()
Used for updating the bank cache, generally reserved for internal use but can be called in a script during custom banking This will clear the bank cache and update it with all bank items
-
deposit
public static boolean deposit(int id, int amount)
-
deposit
public static boolean deposit(java.lang.String name, int amount)
-
deposit
public static boolean deposit(Item item, int amount)
-
depositAllExcept
public static boolean depositAllExcept(java.lang.String... names)
-
depositAllExcept
public static boolean depositAllExcept(java.lang.Integer... ids)
-
depositAllExcept
public static boolean depositAllExcept(int[] ids)
-
deposit
public static boolean deposit(int id)
-
deposit
public static boolean deposit(java.lang.String name)
-
deposit
public static boolean deposit(Item item)
-
depositAll
public static boolean depositAll(int id)
-
depositAll
public static boolean depositAll(java.lang.String name)
-
depositAll
public static boolean depositAll(Item item)
-
fullSlotCount
public static int fullSlotCount()
Full slot count.- Returns:
- the count of full slots as a int.
-
emptySlotCount
public static int emptySlotCount()
Empty slot count.- Returns:
- the count of empty slots as a int.
-
isSlotEmpty
public static boolean isSlotEmpty(int slot)
-
isSlotFull
public static boolean isSlotFull(int slot)
Checks if the slot has an Item in it- Parameters:
slot
- slot to check- Returns:
- True if there's an item there, else False
-
onlyContains
public static boolean onlyContains(java.lang.String... names)
Checks if your Bank only contains items with specified name- Parameters:
names
- Names of items to look for- Returns:
- True if Bank only contains items with that name, else False
-
onlyContains
public static boolean onlyContains(java.lang.Integer... ids)
Checks if your Bank only contains items with specified ID- Parameters:
ids
- IDs of items to check for- Returns:
- True if Bank only contains items with specified ID, else False
-
onlyContains
public static boolean onlyContains(int[] ids)
-
onlyContains
public static boolean onlyContains(Filter<Item> f)
Checks if your Bank only contains items that match the Filter- Parameters:
f
- Filter to pass items through- Returns:
- True if Bank only contains items matching Filter, else False
-
slotContains
public static boolean slotContains(int slot, java.lang.String... names)
Checks if the slot contains items that matches the given names.- Parameters:
names
- names of the items to check- Returns:
- true if Bank only contains items matching Filter, else false
-
slotNameContains
public static boolean slotNameContains(int slot, java.lang.String sub)
Checks if the slot contains items that matches the given ids.- Parameters:
sub
- the substring which will be used to search.- Returns:
- True if Bank only contains items matching Filter, else false.
-
slotContains
public static boolean slotContains(int slot, java.lang.Integer... ids)
Checks if the slot contains an item with an ID matching one of the given ids- Parameters:
ids
- ids of the items to check.- Returns:
- True if Bank slot contains one of the given ids, else false
-
slotContains
public static boolean slotContains(int slot, int[] ids)
-
slotContains
public static boolean slotContains(int slot, Item t)
Checks if the slot contains items that matches the given ids.- Parameters:
t
- The item to check.- Returns:
- True if Bank contains the given item in the given slot, else false
-
slotContains
public static boolean slotContains(int slot, Filter<Item> filter)
Checks if the slot contains an item that matches the filter.- Parameters:
filter
- Filter to pass items through.- Returns:
- True if Bank only contains an item matching the given Filter, else false.
-
getFirstEmptySlot
public static int getFirstEmptySlot()
Gets the first empty slot in the bank.- Returns:
- slot number, if bank is full -1.
-
getFirstFullSlot
public static int getFirstFullSlot()
Gets the next full slot in your bank- Returns:
- slot number, if bank is empty -1
-
getIdForSlot
public static int getIdForSlot(int slot)
Gets the Id of the Item in the slot.- Parameters:
slot
- Slot to get item id of.- Returns:
- Item ID or -1 if no item.
-
getNameForSlot
public static java.lang.String getNameForSlot(int slot)
Gets the Name for the Item in the slot.- Parameters:
slot
- Slot to get item name of.- Returns:
- Item name or "" if item is null.
-
slot
public static int slot(int id)
Gets the slot for the item with specified ID.- Parameters:
id
- ID of item to get slot of.- Returns:
- Item slot or -1 if Item is null.
-
slot
public static int slot(java.lang.String name)
Gets the slot for the item with specified name.- Parameters:
name
- Name of item to get slot of.- Returns:
- Item slot or -1 if Item is null.
-
slot
public static int slot(Filter<Item> filter)
Gets the slot for the first item that matches the given filter- Parameters:
filter
- filter of the item to get slot of.- Returns:
- Item slot or -1 if no slots match the given filter.
-
all
public static java.util.List<Item> all(Filter<Item> filter)
A list of all the items that match the given filter- Parameters:
filter
- the filter to search with.- Returns:
- the list of all filtered items.
-
getItemInSlot
public static Item getItemInSlot(int slot)
Gets item in specified slot.- Parameters:
slot
- the slot.- Returns:
- the item in slot.
-
get
public static Item get(int id)
Gets the first item with the given id- Parameters:
id
- ID of the item to get- Returns:
- Item that matches the given ID, or null if not found
-
get
public static Item get(java.lang.Integer... ids)
Gets the first Item that matches one of the given ids- Parameters:
ids
- ids to check for- Returns:
- First item found or null if none found
-
get
public static Item get(int[] ids)
Seeget(Integer...)
-
get
public static Item get(java.lang.String name)
Get the item for specified name.- Parameters:
name
- the name of the item.- Returns:
- the item if list contains it, otherwise null.
-
get
public static Item get(java.lang.String... names)
Gets the first item that matches one of the given names- Parameters:
names
- Names of the items to look for- Returns:
- The first item in the bank that matches one of the given names, else null if none found
-
except
public static java.util.List<Item> except(Filter<Item> filter)
Get all items which do not fit the given criteria.- Parameters:
filter
- The filter of the items to ignore.- Returns:
- The list of items found which do not match the given criteria.
-
size
public static int size()
-
isEmpty
public static boolean isEmpty()
-
contains
public static boolean contains(int id)
Checks if the bank contains the given ID- Parameters:
id
- the id- Returns:
- true if contains, else false.
-
contains
public static boolean contains(java.lang.String string)
Determines if bank contains an item that matches the given name.- Parameters:
string
- the name of the item.- Returns:
- true if bank contains item, otherwise false.
-
containsAll
public static boolean containsAll(java.lang.String... names)
Checks if your Bank contains all of the items with names specified- Parameters:
names
- Names of items to check for- Returns:
- True if Bank contains all names, else False
-
containsAll
public static boolean containsAll(int[] ids)
Checks if your Bank contains all of the items with specified IDs- Parameters:
ids
- IDs of items to check for- Returns:
- True if Bank contains all IDs, else false.
-
containsAll
public static boolean containsAll(java.lang.Integer... ids)
Checks if your Bank contains all of the items with specified IDs- Parameters:
ids
- IDs of items to check for- Returns:
- True if Bank contains all IDs, else false.
-
containsAll
public static boolean containsAll(java.util.Collection<?> collection)
Checks if your bank contains all of the items in the collections- Parameters:
collection
- The collection of items to compare against- Returns:
- True if bank contains all of the items, else false.
-
contains
public static boolean contains(java.lang.Integer... ids)
Checks if your collection contains one item which meets one of the specified ids.- Parameters:
ids
- Item IDs to check for- Returns:
- True if contains one of, else false
-
contains
public static boolean contains(int[] ids)
-
contains
public static boolean contains(java.lang.String... names)
Checks if your collection contains one item which meets one of the specified names.- Parameters:
names
- names to check for- Returns:
- true if contains one of, else false.
-
contains
public static boolean contains(Filter<Item> filter)
Checks if your collection contains one item which meets the specified filter. Will return false if it's just a placeholder.- Parameters:
filter
- the filter to search with.- Returns:
- true if contains one of, else false.
-
contains
public static boolean contains(java.lang.Object o)
Checks to see if the bank contains an item matching the given Object- Parameters:
o
- Object to check for, could be Integer, String, Filter, or a given Item, all abstracted to 'Object'- Returns:
- True if corresponding contains returns true, false if doesn't contain or cannot find a corresponding contains to call
-
isFull
public static boolean isFull()
Determines if bank is full.- Returns:
- true if full, else false
-
count
public static int count(java.lang.String name)
Count of all the items that match the search.- Parameters:
name
- the name of the item.- Returns:
- the total count of matching items.
-
count
public static int count(int id)
Count of all the items that match the search.- Parameters:
id
- the id of them item.- Returns:
- the total count of matching items.
-
count
public static int count(java.lang.String... names)
Count of all the items that match the search.- Parameters:
names
- the names of the item.- Returns:
- the total count of matching items.
-
count
public static int count(java.lang.Integer... ids)
Count of all the items that match the search.- Parameters:
ids
- the ids of them item.- Returns:
- the total count of matching items.
-
count
public static int count(int[] ids)
-
count
public static int count(Filter<Item> filter)
Count of all the items that match the search.- Parameters:
filter
- the filter to count with- Returns:
- the total count of matching items.
-
drag
public static boolean drag(int fromSlot, int toSlot)
Drags the item from one slot to another, either of which can be empty to simply move an item from one slot to the other- Parameters:
fromSlot
- the first item's slottoSlot
- the second item's slot- Returns:
- true if the items are dragged successfully or if both slots are the same, false otherwise
-
isAlwaysOpenTab
public static boolean isAlwaysOpenTab()
-
setAlwaysOpenTab
public static void setAlwaysOpenTab(boolean alwaysOpenTab)
-
-