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 Deprecated Methods Modifier and Type Method Description static boolean
addToBankHistoryCache(@NonNull 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 our API.static @NonNull java.util.List<@Nullable Item>
all()
Gets the items in your bankstatic @NonNull java.util.List<Item>
all(@NonNull Filter<Item> filter)
A list of all the non-null items that match the given filter Filters out null before checking against the filterstatic int
availableTabs()
Gets the number of tabs currently availablestatic @NonNull java.awt.Rectangle
calculateSlotPosition(int slot)
Gets the virtual position for the specified slot.static int
capacity()
Gets the bank's max capacitystatic boolean
close()
Exits the bank with the close button.static boolean
contains(int id)
Checks if the bank contains the given ID Placeholders are ignoredstatic boolean
contains(int[] ids)
static boolean
contains(@NonNull java.lang.Integer... ids)
Checks if your collection contains at least one item which meets one of the specified ids.static boolean
contains(@NonNull java.lang.Object o)
Checks to see if the bank contains an item matching the given Object Placeholders are ignoredstatic boolean
contains(@NonNull java.lang.String string)
Determines if bank contains an item that matches the given name.static boolean
contains(@NonNull java.lang.String... names)
Checks if your collection contains at least one item which meets one of the specified names.static boolean
contains(@NonNull Filter<Item> filter)
Checks if your collection contains at least one item which meets the specified filter.static boolean
containsAll(int[] ids)
static boolean
containsAll(@NonNull java.lang.Integer... ids)
Checks if your Bank contains all of the items with specified IDs Placeholders are ignoredstatic boolean
containsAll(@NonNull java.lang.String... names)
Checks if your Bank contains all of the items with names specified Placeholders are ignoredstatic boolean
containsAll(@NonNull java.util.Collection<?> collection)
Checks if your bank contains all of the items in the collectionstatic int
count(int id)
Count of all the items that match the search.static int
count(int[] ids)
static int
count(@NonNull java.lang.Integer... ids)
Count of all the items that match the search.static int
count(@NonNull java.lang.String name)
Count of all the items that match the search.static int
count(@NonNull java.lang.String... names)
Count of all the items that match the search.static int
count(@NonNull BankTab tab)
Gets the Item count for the BankTabstatic int
count(@NonNull 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(@NonNull java.lang.String name)
static boolean
deposit(@NonNull java.lang.String name, int amount)
static boolean
deposit(@NonNull Filter<Item> filter)
static boolean
deposit(@NonNull Filter<Item> filter, int amount)
Deposits the first item that matches the givenFilter
for the given amountstatic boolean
deposit(@NonNull Item item)
static boolean
deposit(@NonNull Item item, int amount)
static boolean
depositAll(int id)
static boolean
depositAll(@NonNull java.lang.String name)
static boolean
depositAll(@NonNull Filter<Item> filter)
static boolean
depositAll(@NonNull Item item)
static boolean
depositAllEquipment()
Deposits all worn equipment with the deposit all equipment button.static boolean
depositAllExcept(int[] ids)
static boolean
depositAllExcept(@NonNull java.lang.Integer... ids)
static boolean
depositAllExcept(@NonNull java.lang.String... names)
static boolean
depositAllExcept(@NonNull Filter<Item> filter)
Deposits all items that do not match the givenFilter
Will calldepositAllItems()
if your inventory does not contain any of the given filter (nothing to exclude)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()
Number of slots that do not contain an item or placeholderstatic @NonNull java.util.List<Item>
except(@NonNull Filter<Item> filter)
Get all items which do not fit the given criteria.static int
fullSlotCount()
Number of slots that contain non-null items Includes placeholders as a full slotstatic @Nullable Item
get(int id)
Gets the first item with the given idstatic @Nullable Item
get(int[] ids)
Seeget(Integer...)
static @Nullable Item
get(@NonNull java.lang.Integer... ids)
Gets the first Item that matches one of the given idsstatic @Nullable Item
get(@NonNull java.lang.String name)
Get the item for specified name.static @Nullable Item
get(@NonNull java.lang.String... names)
Gets the first item that matches one of the given namesstatic @Nullable Item
get(Filter<Item> filter)
static @NonNull java.util.List<@Nullable Item>
getBankHistoryCache()
Gets the bank item history cache.static @Nullable WidgetChild
getChild(int id)
Gets theWidgetChild
of theItem
with the given IDstatic @Nullable WidgetChild
getChild(@NonNull java.lang.String name)
Gets theWidgetChild
of theItem
with the given namestatic @Nullable WidgetChild
getChild(@NonNull Filter<Item> filter)
static @Nullable WidgetChild
getChild(@NonNull Item item)
Gets theWidgetChild
of theItem
based on the item's slot valuestatic @Nullable WidgetChild
getChildForSlot(int slot)
Gets the WidgetChild for the given slotstatic @Nullable Entity
getClosestBank(@NonNull BankType type)
Gets the nearest bank interactable based on BankTypestatic @Nullable BankLocation
getClosestBankLocation()
Get the closest bank location.static @Nullable BankLocation
getClosestBankLocation(boolean includeTeleports)
Gets the nearest bank location seeBankLocation.getNearest(Tile, boolean)
static @Nullable BankTab
getCurrentBankTab()
Gets the currentBankTab
static int
getCurrentTab()
Gets the current tab that is openstatic int
getCustomWithdrawAmount()
static @NonNull BankQuantitySelection
getDefaultQuantity()
Gets the currently selected default quantity for withdraw or deposit actionsstatic 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 theItem
in the slot.static @Nullable Item
getItemInSlot(int slot)
Gets item in specified slot.static long
getLastBankHistoryCacheTick()
Returns the last game tick (usingClient.getGameTick()
) of a cache updatestatic 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 @NonNull BankMode
getRearrangeMode()
Gets the current rearrange mode type;static int
getRow(@NonNull Item item)
Gets the row of theItem
static int
getScrollHeight()
Determines the current scroll position height of the bank's scroll container.static int
getSlot(int id)
Gets the slot for the item with specified ID.static int
getSlot(@NonNull java.lang.String name)
Gets the slot for the item with specified name.static int
getSlot(@NonNull Filter<Item> filter)
Gets the slot for the first item that matches the given filterstatic int
getTab(int slot)
static int
getTab(@NonNull Item item)
Gets the tab for theItem
static @NonNull BankMode
getWithdrawMode()
Gets the current withdrawBankMode
static boolean
isAlwaysOpenTab()
static boolean
isCached()
Checks if the bank has been cached.static boolean
isEmpty()
Checks if the bank is empty (including placeholders)static boolean
isFull()
Determines if bank is full.static boolean
isLoaded()
Checks to see if the Bank container has been loaded successfully at least once Check is done duringall()
callstatic boolean
isOpen()
Checks if the bank is currently open or not.static boolean
isSlotEmpty(int slot)
Checks if the given slot contains an itemstatic boolean
isSlotFull(int slot)
Checks if the slot has an Item in itstatic boolean
isSlotVisible(@NonNull Item item)
Determines if the givenItem
's slot is visiblestatic boolean
needToScroll(@NonNull Item item)
Determines if the bot needs to scroll to find theItem
static boolean
needToScrollDown(@NonNull Item item)
Determines if it needs to scroll down for theItem
to be visiblestatic boolean
needToScrollUp(@NonNull Item item)
Determines if it needs to scroll up in order to see the givenItem
static boolean
onlyContains(int[] ids)
static boolean
onlyContains(@NonNull java.lang.Integer... ids)
Checks if your Bank only contains items with the specified IDsstatic boolean
onlyContains(@NonNull java.lang.String... names)
Checks if your Bank only contains items with specified namesstatic boolean
onlyContains(@NonNull 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(@Nullable 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(@NonNull BankTab tab)
Opens theBankTab
specified.static boolean
placeHoldersEnabled()
Checks whether placeholders are currently enabledstatic void
resetCache()
This will reset the bank history cache to it's initial statestatic boolean
scroll(int id)
Scrolls to the item with the given ID seescroll(int, BankScroll)
with a random choice of scroll typesstatic boolean
scroll(int id, @NonNull BankScroll type)
Scrolls to the item with the given ID using theBankScroll
scroll typestatic boolean
scroll(@NonNull java.lang.String name)
Scrolls to the item with the given name seescroll(String, BankScroll)
with a randomBankScroll
typestatic boolean
scroll(@NonNull java.lang.String name, @NonNull BankScroll type)
Scrolls to the item with the given name using the givenBankScroll
typestatic boolean
scroll(@NonNull Filter<Item> filter)
Scrolls to the item which matches the given filter.static boolean
scroll(@NonNull Filter<Item> filter, @NonNull BankScroll type)
Scrolls to the item which matches the given filter using the givenBankScroll
typestatic @Nullable Item
set(int index, @Nullable Item element)
Sets anItem
to the given slot Used internally, shouldn't really be touched by API usersstatic void
setAlwaysOpenTab(boolean alwaysOpenTab)
static boolean
setDefaultQuantity(@NonNull BankQuantitySelection selection)
Sets theBankQuantitySelection
for bank actionsstatic boolean
setRearrangeMode(@NonNull BankMode mode)
Sets the Rearrange mode for the bank eitherBankMode.SWAP
orBankMode.INSERT
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(@NonNull BankMode mode)
Sets the withdraw mode, eitherBankMode.ITEM
orBankMode.NOTE
static int
size()
Deprecated.seefullSlotCount()
static int
slot(int id)
Deprecated.seegetSlot(int)
static int
slot(@NonNull java.lang.String name)
Deprecated.seegetSlot(String)
static int
slot(@NonNull Filter<Item> filter)
Deprecated.seegetSlot(Filter)
static @Nullable java.awt.Rectangle
slotBounds(int slot)
Gets the bounds of a slotstatic @Nullable java.awt.Rectangle
slotBounds(@NonNull Item item)
CallsslotBounds(int)
withItem.getSlot()
If Item is null returns null Rectanglestatic boolean
slotContains(int slot, int[] ids)
static boolean
slotContains(int slot, @NonNull java.lang.Integer... ids)
Checks if the slot contains an item with an ID matching one of the given idsstatic boolean
slotContains(int slot, @NonNull java.lang.String... names)
Checks if the slot contains items that matches the given names.static boolean
slotContains(int slot, @NonNull Filter<Item> filter)
Checks if the slot contains an item that matches the filter.static boolean
slotContains(int slot, @NonNull Item t)
Checks if the slot contains givenItem
static boolean
slotNameContains(int slot, @NonNull java.lang.String sub)
Checks if the slot has an item whose name contains the given sub stringstatic int
tabContainerWidgetId()
Gets the ID of theWidgetChild
for the tab containerstatic boolean
togglePlaceholders(boolean enabled)
Toggles whether placeholders are enabled or notstatic 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(@NonNull 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()
Gets the ID of theWidgetChild
for the bank interfacestatic int
widgetParentId()
Gets the ID of theWidget
for the bankstatic boolean
withdraw(int id)
Withdraws one of the given item idstatic boolean
withdraw(int id, int amount)
Withdraws an item for the id and amount given.static boolean
withdraw(@NonNull Filter<Item> filter)
Withdraws one item that matches the givenFilter
static boolean
withdraw(@NonNull Filter<Item> filter, int amount)
Withdraws an item that matches the givenFilter
for the given amount For withdraw All-but-one pass in value: -9411static boolean
withdraw(java.lang.String name)
Withdraws one of an item with the given namestatic boolean
withdraw(java.lang.String name, int amount)
Withdraws an item for the name and amount given.static boolean
withdrawAll(int id)
Withdraws all of an item for a given IDstatic boolean
withdrawAll(@NonNull Filter<Item> filter)
Withdraws all of an item that matches the givenFilter
static boolean
withdrawAll(java.lang.String name)
Withdraws all of an item for the given name
-
-
-
Method Detail
-
widgetParentId
public static int widgetParentId()
Gets the ID of theWidget
for the bank
-
widgetChildId
public static int widgetChildId()
Gets the ID of theWidgetChild
for the bank interface- Returns:
-
tabContainerWidgetId
public static int tabContainerWidgetId()
Gets the ID of theWidgetChild
for the tab container
-
capacity
public static int capacity()
Gets the bank's max capacity- Returns:
- constant value (currently 1220)
-
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 @NonNull java.util.List<@Nullable Item> all()
Gets the items in your bank- Returns:
- list of all unfiltered items in your bank - this includes null items
-
isLoaded
public static boolean isLoaded()
Checks to see if the Bank container has been loaded successfully at least once Check is done duringall()
call- Returns:
- True if the bank container has been loaded successfully once
-
calculateSlotPosition
public static @NonNull 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 @Nullable Entity getClosestBank(@NonNull BankType type)
Gets the nearest bank interactable based on BankType- Parameters:
type
- bank type to look for- Returns:
- entity of closest bank object, null if no recognized bank type
-
open
public static boolean open()
Finds the nearest BankType and attempts to open it. This method will walk one step towards 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(@Nullable 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 @Nullable BankLocation getClosestBankLocation()
Get the closest bank location. Does not include teleports in this calculation- Returns:
- the bank location closest to your player.
-
getClosestBankLocation
public static @Nullable BankLocation getClosestBankLocation(boolean includeTeleports)
Gets the nearest bank location seeBankLocation.getNearest(Tile, boolean)
- Parameters:
includeTeleports
- whether to include use of teleports in inventory/equipment when calculating closest bank- Returns:
- Closest bank location
-
withdraw
public static boolean withdraw(int id)
Withdraws one of the given item id- 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 an item for a given ID- 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 one of an item with the given name- Parameters:
name
- The name of the item to withdraw, case-insensitive.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(java.lang.String name, int amount)
Withdraws an item for the name and amount given.- Parameters:
name
- The name of the item to withdraw, case-insensitiveamount
- The amount to withdraw.- Returns:
- True if interaction was successful, else False
-
withdrawAll
public static boolean withdrawAll(java.lang.String name)
Withdraws all of an item for the given name- Parameters:
name
- The name of the item to withdraw, case-insensitive.- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(@NonNull Filter<Item> filter)
Withdraws one item that matches the givenFilter
- Parameters:
filter
- The filter to match the item against- Returns:
- True if interaction was successful, else False
-
withdrawAll
public static boolean withdrawAll(@NonNull Filter<Item> filter)
Withdraws all of an item that matches the givenFilter
- Parameters:
filter
- The filter to match the item against- Returns:
- True if interaction was successful, else False
-
withdraw
public static boolean withdraw(@NonNull Filter<Item> filter, int amount)
Withdraws an item that matches the givenFilter
for the given amount For withdraw All-but-one pass in value: -9411- Parameters:
filter
- The filter to match the item againstamount
- 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(@NonNull Filter<Item> filter, int amount)
Deposits the first item that matches the givenFilter
for the given amount- Parameters:
filter
- The filter to match the item againstamount
- The amount of the item to deposit.- Returns:
- True if deposit success, else False
-
depositAllExcept
public static boolean depositAllExcept(@NonNull Filter<Item> filter)
Deposits all items that do not match the givenFilter
Will calldepositAllItems()
if your inventory does not contain any of the given filter (nothing to exclude)- Parameters:
filter
- Filter to exclude from the deposit all iterations- Returns:
- True if all items that don't match the given filter are deposited
-
close
public static boolean close()
Exits the bank with the close button. If Esc Interface Closing is enabled, it will close with the ESC key SeeClientSettings.isEscInterfaceClosingEnabled()
- Returns:
- True if bank is already closed, or if the bank is successfully closed, 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 @Nullable 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 @Nullable java.awt.Rectangle slotBounds(@NonNull Item item)
CallsslotBounds(int)
withItem.getSlot()
If Item is null returns null Rectangle
-
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(@NonNull BankTab tab)
Opens theBankTab
specified.- Parameters:
tab
- The BankTab to open.- Returns:
- True if BankTab was opened, else false
-
getBankHistoryCache
public static @NonNull java.util.List<@Nullable Item> getBankHistoryCache()
Gets the bank item history cache. The history cache is updated periodically as bank methods are called like withdraw, deposit, all- Returns:
- list of all your bank items since your last visit.
-
addToBankHistoryCache
public static boolean addToBankHistoryCache(@NonNull 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 our API. If the cache already contains the given item, we'll add (or subtract if given an item with a negative amount) to the item's amount in cache.- 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
-
getLastBankHistoryCacheTick
public static long getLastBankHistoryCacheTick()
Returns the last game tick (usingClient.getGameTick()
) of a cache update- Returns:
- game tick of last cache update, or 0 if the bank cache hasn't been created yet
-
isCached
public static boolean isCached()
Checks if the bank has been cached.- Returns:
- true if we've cached the bank's items, false otherwise
-
getChild
public static @Nullable WidgetChild getChild(int id)
Gets theWidgetChild
of theItem
with the given ID- Parameters:
id
- the id of the item- Returns:
- WidgetChild of the item
-
getChild
public static @Nullable WidgetChild getChild(@NonNull java.lang.String name)
Gets theWidgetChild
of theItem
with the given name- Parameters:
name
- the name of the item- Returns:
- WidgetChild of the item
-
getChild
public static @Nullable WidgetChild getChild(@NonNull Filter<Item> filter)
- Parameters:
filter
- the filter used to find item.- Returns:
- WidgetChild of the item
-
getChild
public static @Nullable WidgetChild getChild(@NonNull Item item)
Gets theWidgetChild
of theItem
based on the item's slot value- Parameters:
item
- Item to get the child of- Returns:
- WidgetChild of the item
-
getChildForSlot
public static @Nullable 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 @NonNull BankMode getRearrangeMode()
Gets the current rearrange mode type;- Returns:
- current rearrange mode wrapped in a
BankMode
object.
-
isSlotVisible
public static boolean isSlotVisible(@NonNull Item item)
Determines if the givenItem
's slot is visible- Parameters:
item
- The item that the slot you are searching for contains.- Returns:
- True if slot is visible, else false
-
getWithdrawMode
public static @NonNull BankMode getWithdrawMode()
Gets the current withdrawBankMode
- Returns:
- current withdraw mode either
BankMode.ITEM
orBankMode.NOTE
-
setWithdrawMode
public static boolean setWithdrawMode(@NonNull BankMode mode)
Sets the withdraw mode, eitherBankMode.ITEM
orBankMode.NOTE
- Parameters:
mode
-BankMode
to switch to- Returns:
- True if successfully switched, else false
-
setRearrangeMode
public static boolean setRearrangeMode(@NonNull BankMode mode)
Sets the Rearrange mode for the bank eitherBankMode.SWAP
orBankMode.INSERT
- Parameters:
mode
-BankMode
- Returns:
- true if successfully switched else false
-
getDefaultQuantity
public static @NonNull BankQuantitySelection getDefaultQuantity()
Gets the currently selected default quantity for withdraw or deposit actions
-
setDefaultQuantity
public static boolean setDefaultQuantity(@NonNull BankQuantitySelection selection)
Sets theBankQuantitySelection
for bank actions- Parameters:
selection
-BankQuantitySelection
- Returns:
- True if quantity successfully selected
-
placeHoldersEnabled
public static boolean placeHoldersEnabled()
Checks whether placeholders are currently enabled
-
togglePlaceholders
public static boolean togglePlaceholders(boolean enabled)
Toggles whether placeholders are enabled or not- Parameters:
enabled
- True/False- Returns:
- True if placeholders successfully set to given boolean
-
needToScrollUp
public static boolean needToScrollUp(@NonNull Item item)
Determines if it needs to scroll up in order to see the givenItem
- Parameters:
item
- The item that you're looking for- Returns:
- True if it needs to scroll up, else false
-
needToScrollDown
public static boolean needToScrollDown(@NonNull Item item)
Determines if it needs to scroll down for theItem
to be visible- Parameters:
item
- The item you're looking for- Returns:
- True if you need to scroll down, else false
-
needToScroll
public static boolean needToScroll(@NonNull Item item)
Determines if the bot needs to scroll to find theItem
- Parameters:
item
- The item that you're checking for- Returns:
- True if the bank needs to scroll up or down for the item to be visible
-
getRow
public static int getRow(@NonNull Item item)
Gets the row of theItem
- Parameters:
item
- Item to find the row of- Returns:
- Integer value of the row of the Item based on
Item.getSlot()
-
getTab
public static int getTab(@NonNull Item item)
Gets the tab for theItem
- Parameters:
item
- Item to get the tab of, based onItem.getSlot()
- Returns:
- Integer value of the tab the item is in, 0 if not found
-
getTab
public static int getTab(int slot)
-
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(@NonNull BankTab tab)
Gets the Item count for the BankTab- Returns:
- Integer value with how many items are in the tab
-
getCurrentBankTab
public static @Nullable BankTab getCurrentBankTab()
Gets the currentBankTab
- 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, @NonNull BankScroll type)
Scrolls to the item with the given ID using theBankScroll
scroll type- 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 with the given ID seescroll(int, BankScroll)
with a random choice of scroll types
-
scroll
public static boolean scroll(@NonNull java.lang.String name, @NonNull BankScroll type)
Scrolls to the item with the given name using the givenBankScroll
type- 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(@NonNull java.lang.String name)
Scrolls to the item with the given name seescroll(String, BankScroll)
with a randomBankScroll
type
-
scroll
public static boolean scroll(@NonNull Filter<Item> filter, @NonNull BankScroll type)
Scrolls to the item which matches the given filter using the givenBankScroll
type- Parameters:
filter
- the filter of the item to scroll to.type
- the method of scrolling you would prefer to use, however it will always use the scroll wheel if you have more than 300 items in your bank or if you're on resizable mode- Returns:
- true if the item is visible after scrolling.
-
scroll
public static boolean scroll(@NonNull Filter<Item> filter)
Scrolls to the item which matches the given filter. seescroll(Filter, BankScroll)
with a randomizedBankScroll
type
-
updateCache
public static void updateCache(@NonNull 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(@NonNull java.lang.String name, int amount)
-
deposit
public static boolean deposit(@NonNull Item item, int amount)
-
depositAllExcept
public static boolean depositAllExcept(@NonNull java.lang.String... names)
-
depositAllExcept
public static boolean depositAllExcept(@NonNull java.lang.Integer... ids)
-
depositAllExcept
public static boolean depositAllExcept(int[] ids)
-
deposit
public static boolean deposit(int id)
-
deposit
public static boolean deposit(@NonNull java.lang.String name)
-
deposit
public static boolean deposit(@NonNull Item item)
-
depositAll
public static boolean depositAll(int id)
-
depositAll
public static boolean depositAll(@NonNull java.lang.String name)
-
depositAll
public static boolean depositAll(@NonNull Item item)
-
fullSlotCount
public static int fullSlotCount()
Number of slots that contain non-null items Includes placeholders as a full slot
-
emptySlotCount
public static int emptySlotCount()
Number of slots that do not contain an item or placeholder
-
isSlotEmpty
public static boolean isSlotEmpty(int slot)
Checks if the given slot contains an item
-
isSlotFull
public static boolean isSlotFull(int slot)
Checks if the slot has an Item in it
-
onlyContains
public static boolean onlyContains(@NonNull java.lang.String... names)
Checks if your Bank only contains items with specified names- Parameters:
names
- Names of items to look for- Returns:
- True if Bank only contains items with the given names, else False
-
onlyContains
public static boolean onlyContains(@NonNull java.lang.Integer... ids)
Checks if your Bank only contains items with the specified IDs- Parameters:
ids
- IDs of items to check for- Returns:
- True if Bank only contains items with the specified IDs, else False
-
onlyContains
public static boolean onlyContains(int[] ids)
-
onlyContains
public static boolean onlyContains(@NonNull 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, @NonNull 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, @NonNull java.lang.String sub)
Checks if the slot has an item whose name contains the given sub string- Parameters:
sub
- the substring which will be used to search.- Returns:
- True if Bank only contains items matching substring, else false.
-
slotContains
public static boolean slotContains(int slot, @NonNull 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, @NonNull Item t)
Checks if the slot contains givenItem
- 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, @NonNull 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 theItem
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.
-
getSlot
public static int getSlot(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
@Deprecated public static int slot(int id)
Deprecated.seegetSlot(int)
-
getSlot
public static int getSlot(@NonNull 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
@Deprecated public static int slot(@NonNull java.lang.String name)
Deprecated.seegetSlot(String)
-
getSlot
public static int getSlot(@NonNull 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.
-
slot
@Deprecated public static int slot(@NonNull Filter<Item> filter)
Deprecated.seegetSlot(Filter)
-
all
public static @NonNull java.util.List<Item> all(@NonNull Filter<Item> filter)
A list of all the non-null items that match the given filter Filters out null before checking against the filter- Parameters:
filter
- the filter to search with.- Returns:
- the list of all filtered items.
-
getItemInSlot
public static @Nullable Item getItemInSlot(int slot)
Gets item in specified slot.- Parameters:
slot
- the slot.- Returns:
- the item in slot.
-
get
public static @Nullable 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 @Nullable Item get(@NonNull 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 @Nullable Item get(int[] ids)
Seeget(Integer...)
-
get
public static @Nullable Item get(@NonNull 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 @Nullable Item get(@NonNull 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 @NonNull java.util.List<Item> except(@NonNull Filter<Item> filter)
Get all items which do not fit the given criteria. Ignores placeholders- Parameters:
filter
- The filter of the items to ignore.- Returns:
- The list of items found which do not match the given criteria.
-
size
@Deprecated public static int size()
Deprecated.seefullSlotCount()
-
isEmpty
public static boolean isEmpty()
Checks if the bank is empty (including placeholders)
-
contains
public static boolean contains(int id)
Checks if the bank contains the given ID Placeholders are ignored- Parameters:
id
- the id- Returns:
- true if contains, else false.
-
contains
public static boolean contains(@NonNull java.lang.String string)
Determines if bank contains an item that matches the given name. Placeholders are ignored- Parameters:
string
- the name of the item.- Returns:
- true if bank contains item, otherwise false.
-
containsAll
public static boolean containsAll(@NonNull java.lang.String... names)
Checks if your Bank contains all of the items with names specified Placeholders are ignored- Parameters:
names
- Names of items to check for- Returns:
- True if Bank contains all names, else False
-
containsAll
public static boolean containsAll(int[] ids)
-
containsAll
public static boolean containsAll(@NonNull java.lang.Integer... ids)
Checks if your Bank contains all of the items with specified IDs Placeholders are ignored- Parameters:
ids
- IDs of items to check for- Returns:
- True if Bank contains all IDs, else false.
-
containsAll
public static boolean containsAll(@NonNull java.util.Collection<?> collection)
Checks if your bank contains all of the items in the collection- 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(@NonNull java.lang.Integer... ids)
Checks if your collection contains at least one item which meets one of the specified ids. Placeholders are ignored- 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(@NonNull java.lang.String... names)
Checks if your collection contains at least one item which meets one of the specified names. Placeholders are ignored- Parameters:
names
- names to check for- Returns:
- true if contains one of, else false.
-
contains
public static boolean contains(@NonNull Filter<Item> filter)
Checks if your collection contains at least one item which meets the specified filter. Placeholders are ignored- Parameters:
filter
- the filter to search with.- Returns:
- true if contains one of, else false.
-
contains
public static boolean contains(@NonNull java.lang.Object o)
Checks to see if the bank contains an item matching the given Object Placeholders are ignored- 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(@NonNull java.lang.String name)
Count of all the items that match the search. Placeholders are ignored- 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. Placeholders are ignored- Parameters:
id
- the id of them item.- Returns:
- the total count of matching items.
-
count
public static int count(@NonNull java.lang.String... names)
Count of all the items that match the search. Placeholders are ignored- Parameters:
names
- the names of the item.- Returns:
- the total count of matching items.
-
count
public static int count(@NonNull java.lang.Integer... ids)
Count of all the items that match the search. Placeholders are ignored- 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(@NonNull Filter<Item> filter)
Count of all the items that match the search. Placeholders are ignored- Parameters:
filter
- the filter to count with- Returns:
- the total count of matching items.
-
set
public static @Nullable Item set(int index, @Nullable Item element)
Sets anItem
to the given slot Used internally, shouldn't really be touched by API users
-
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
-
getCustomWithdrawAmount
public static int getCustomWithdrawAmount()
-
isAlwaysOpenTab
public static boolean isAlwaysOpenTab()
-
setAlwaysOpenTab
public static void setAlwaysOpenTab(boolean alwaysOpenTab)
-
-