Class Bank
- java.lang.Object
-
- net.eternalclient.api.containers.bank.Bank
-
public class Bank extends java.lang.Object
The Bank class provides methods and functionalities related to interacting with the player's bank.
-
-
Constructor Summary
Constructors Constructor Description Bank()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<Item>
all()
Returns a list of all items in the container.static java.util.List<Item>
all(boolean filterPlaceholders)
Returns a List of all non-null and non-zero amount Items from the cache, excluding placeholders if filterPlaceholders is true.static java.util.List<Item>
all(int... ids)
Returns a list of all items with the given IDs.static java.util.List<Item>
all(java.lang.String... names)
Returns a list of all items with the given names.static java.util.List<Item>
all(java.util.function.Predicate<Item> predicate)
Returns a list of all items that satisfy the given predicate.static java.util.List<Item>
all(Item... items)
Returns a list of all items with the given items.static java.util.List<Item>
all(ItemVariant itemVariant)
Returns a list of all items with the given variant.static java.util.List<Item>
allExcept(int... ids)
Returns a list of all items except those with the given IDs.static java.util.List<Item>
allExcept(java.lang.String... names)
Returns a list of all items except those with the given names.static java.util.List<Item>
allExcept(java.util.function.Predicate<Item> predicate)
Returns a list of all items except those that satisfy the given predicate.static java.util.List<Item>
allExcept(Item... items)
Returns a list of all items except those with the given items.static java.util.List<Item>
allExcept(ItemVariant itemVariant)
Returns a list of all items except those with the given variant.static java.awt.Rectangle
calculateSlotBounds(int slot)
Calculates the bounds for slot in the bank regardless whether or not an item exists in the slot.static int
capacity()
Returns the capacity of the container.static boolean
close()
Closes the bank if it is open and the Escape key is pressed, otherwise closes the bank by clicking the "Close" button.static boolean
contains(int id)
Checks if the container contains an item with the given ID.static boolean
contains(int... ids)
Checks if the container contains items with the given IDs.static boolean
contains(java.lang.String name)
Checks if the container contains an item with the given name.static boolean
contains(java.lang.String... names)
Checks if the container contains items with the given names.static boolean
contains(java.util.function.Predicate<Item> predicate)
Checks if the container contains an item that satisfies the given predicate.static boolean
contains(Item item)
Checks if the container contains the given item.static boolean
contains(Item... items)
Checks if the container contains the given items.static boolean
contains(ItemVariant itemVariant)
Checks if the container contains the given item variant.static boolean
containsAll(int id)
Checks if the container contains all items with the given ID.static boolean
containsAll(int... ids)
Checks if the container contains all items with the given IDs.static boolean
containsAll(java.lang.String name)
Checks if the container contains all items with the given name.static boolean
containsAll(java.lang.String... names)
Checks if the container contains all items with the given names.static boolean
containsAll(java.util.function.Predicate<Item> predicate)
Checks if the container contains all items that satisfy the given predicate.static boolean
containsAll(Item item)
Checks if the container contains all items with the given item.static boolean
containsAll(Item... items)
Checks if the container contains all items with the given items.static boolean
containsAll(ItemVariant itemVariant)
Checks if the container contains all items with the given item variant.static int
count(int id)
Returns the total amount of items in the container with the given ID.static int
count(int... ids)
Returns the total amount of items in the container with the given IDs.static int
count(java.lang.String name)
Returns the total amount of items in the container with the given name.static int
count(java.lang.String... names)
Returns the total amount of items in the container with the given names.static int
count(java.util.function.Predicate<Item> predicate)
Returns the total amount of items in the container that satisfy the given predicate.static int
count(Item item)
Returns the total amount of items in the container in which the item has the same ID as the given item.static int
count(Item... items)
Returns the total amount of items in the container in which the item has the same ID as the given items.static int
count(ItemVariant itemVariant)
Returns the total amount of items in the container in which the item matches the variant.static int
countAll(java.util.function.Predicate<Item> predicate)
Returns the total count of the amount from all the items that satisfy the given predicate.static boolean
deposit(int id, int count)
Deposits a specified amount into the account with the given ID.static boolean
deposit(java.lang.String name, int count)
Creates a deposit event with the given name and count, then executes it.static boolean
deposit(java.util.function.Predicate<Item> predicate, int count)
Executes a deposit event with the given predicate and count.static boolean
depositAll(int id)
Deposits all items with specified id into the Inventory.static boolean
depositAll(java.lang.String name)
Deposits all items with the given name from the player's inventory.static boolean
depositAll(java.util.function.Predicate<Item> predicate)
Deposits all items from the inventory that satisfy the given predicate.static boolean
depositAllExcept(java.util.function.Predicate<Item> predicate)
Deposits all items except those that match the given predicate and returns true if all items passed the predicate test.static boolean
depositEquipment()
Deposits equipment and returns a boolean indicating if the deposit was successfully executed.static boolean
depositInventory()
Executes the deposit inventory event and returns true if it was successfully executed.static int
find(int... ids)
Returns the first item ID in the container that matches any of the given IDs, or -1 if no such item exists.static int
find(int[] ids, int defaultValue)
Returns the first item ID in the container that matches any of the given IDs, or the default value if no such item exists.static int
find(java.lang.String... names)
Returns the first item ID of an item in the container in which the name matches any of the given names, or -1 if no such item exists.static int
find(java.lang.String[] names, int defaultValue)
Returns the first item ID of an item in the container in which the name matches any of the given names, or the default value if no such item exists.static int
find(java.util.function.Predicate<Item> predicate)
Returns the first item ID in the container that satisfies the given predicate, or -1 if no such item exists.static int
find(java.util.function.Predicate<Item> predicate, int defaultValue)
Returns the first item ID in the container that satisfies the given predicate, or the default value if no such item exists.static int
find(ItemVariant variant)
Returns the first item ID in the container that matches the given variant, or -1 if no such item exists.static int
find(ItemVariant variant, int defaultValue)
Returns the first item ID in the container that matches the given variant, or the default value if no such item exists.static int
findForSlot(int slot)
Returns the item ID in the given slot, or -1 if no such item exists.static int
findForSlot(int slot, int defaultValue)
Returns the item ID in the given slot, or the default value if no such item exists.static void
forceUpdateBankCache()
Updates the bank cache by retrieving the container from the client and updating the cache.static int
freeSlots()
Returns the number of free slots in the container.static Item
get(int id)
Returns the item with the given ID.static Item
get(java.lang.String name)
Returns the item with the given name.static Item
get(java.util.function.Predicate<Item> predicate)
Returns the item that satisfies the given predicate.static Item
get(ItemVariant itemVariant)
Returns the item with the given variant.static java.util.List<Item>
getBankHistoryCache()
Returns the cache of previous items in the bank history.static ItemContainerCache
getCache()
static BankLocation
getClosestBank()
Returns the closest bank location that has requirements.static BankTab
getCurrentBankTab()
Returns the current bank tab based on the configuration value.static int
getFirstEmptySlot()
Returns the first empty slot in the container.static int
getFirstFullSlot()
Returns the first full slot in the container.static Item
getForSlot(int slot)
Returns the item in the given slot.static BankMode
getRearrangeMode()
Retrieves the rearrange mode for the bank.static int
getSize()
static java.awt.Rectangle
getSlotBounds(int slot)
Returns the bounds of the slot in the bank.static java.awt.Rectangle
getSlotBounds(Item item)
Returns the bounds of the slot in the bank.static BankMode
getWithdrawMode()
Returns the mode for withdrawing from the bank.static boolean
isEmpty()
Checks if the container is empty.static boolean
isFull()
Checks if the container is full.static boolean
isOpen()
Checks if the bank is open.static boolean
isPinOpen()
Checks if the bank PIN interface is open.static boolean
onlyContains(int id)
Checks if the container only contains an item with the given ID.static boolean
onlyContains(int... ids)
Checks if the container only contains items with the given IDs.static boolean
onlyContains(java.lang.String name)
Checks if the container only contains an item with the given name.static boolean
onlyContains(java.lang.String... names)
Checks if the container only contains items with the given names.static boolean
onlyContains(java.util.function.Predicate<Item> predicate)
Checks if the container only contains items that satisfy the given predicate.static boolean
onlyContains(Item item)
Checks if the container only contains the given item.static boolean
onlyContains(Item... items)
Checks if the container only contains the given items.static boolean
onlyContains(ItemVariant itemVariant)
Checks if the container only contains the given item variant.static boolean
open()
Checks if the bank is already open and returns true.static boolean
openClosest()
Opens the closest object and returns true if successful; otherwise returns false.static boolean
openClosest(WalkCondition condition)
Checks if a doorway is open.static boolean
setRearrangeMode(BankMode mode)
Sets the rearrange mode for the bank.static boolean
setWithdrawMode(BankMode mode)
Sets the withdraw mode for the bank.static boolean
traverseOpen(BankLocation bank)
Traverses the specified bank location and returns true if it is open, false otherwise.static boolean
traverseOpen(BankLocation bank, WalkCondition condition)
Traverses to the specified bank location if the distance is greater than 10 or the plane is different, and returns whether the bank is successfully opened.static int
usedSlots()
Returns the number of used slots in the container.static boolean
withdraw(int id, int count)
Withdraws the specified count of money from the account with the given ID.static boolean
withdraw(int id, int count, boolean noted)
Withdraws the specified count from the given account ID and returns true if successful, false otherwise.static boolean
withdraw(java.lang.String name, int count)
Withdraws a specified amount from an account.static boolean
withdraw(java.lang.String name, int count, boolean noted)
Withdraws a certain amount from an account with the given name.static boolean
withdraw(java.util.function.Predicate<Item> predicate, int count)
Withdraws a specified number of items from the inventory based on a given predicate.static boolean
withdraw(java.util.function.Predicate<Item> predicate, int count, boolean noted)
Withdraws items from a bank based on the given predicate, count, and note preference.static boolean
withdrawAll(int id)
Withdraws all funds from the account with the specified ID.static boolean
withdrawAll(int id, boolean noted)
Withdraws all funds from the specified account.static boolean
withdrawAll(java.lang.String name)
Withdraws all items with a specific name from the bank.static boolean
withdrawAll(java.lang.String name, boolean noted)
Withdraws all the funds for the specified name, optionally taking note.static boolean
withdrawAll(java.util.function.Predicate<Item> predicate)
Withdraws all items from the specified inventory that satisfy the given predicate.static boolean
withdrawAll(java.util.function.Predicate<Item> predicate, boolean noted)
Withdraws all items from the inventory based on a given predicate, optionally noting them.
-
-
-
Method Detail
-
getSize
public static int getSize()
-
getCache
public static ItemContainerCache getCache()
-
getBankHistoryCache
public static java.util.List<Item> getBankHistoryCache()
Returns the cache of previous items in the bank history.- Returns:
- the list of previous items in the bank history cache
-
calculateSlotBounds
public static java.awt.Rectangle calculateSlotBounds(int slot)
Calculates the bounds for slot in the bank regardless whether or not an item exists in the slot. Returns null if it's not able to find the bank item container widget.- Parameters:
slot
- the slot to calculate the position for- Returns:
- the bounds of the slot, or null if the bank item container widget is not found
-
getSlotBounds
public static java.awt.Rectangle getSlotBounds(int slot)
Returns the bounds of the slot in the bank.- Parameters:
slot
- the slot to get the bounds for- Returns:
- the bounds of the slot in the bank, null if there is no item in the slot
-
getSlotBounds
public static java.awt.Rectangle getSlotBounds(Item item)
Returns the bounds of the slot in the bank.- Parameters:
item
- the item to get the bounds for- Returns:
- the bounds of the slot in the bank, null if there is no item in the slot
-
forceUpdateBankCache
public static void forceUpdateBankCache()
Updates the bank cache by retrieving the container from the client and updating the cache.
-
isOpen
public static boolean isOpen()
Checks if the bank is open.- Returns:
- true if the bank is open, false otherwise.
-
isPinOpen
public static boolean isPinOpen()
Checks if the bank PIN interface is open.- Returns:
- true if the bank PIN interface is open, false otherwise.
-
open
public static boolean open()
Checks if the bank is already open and returns true. Otherwise, executes a new OpenBankEvent and returns its result.- Returns:
- the result of the OpenBankEvent execution.
-
openClosest
public static boolean openClosest()
Opens the closest object and returns true if successful; otherwise returns false.- Returns:
- true if the closest object is successfully opened, false otherwise
-
openClosest
public static boolean openClosest(WalkCondition condition)
Checks if a doorway is open. If it is not, walks to the nearest bank using a specified condition.- Parameters:
condition
- the condition to determine the walking path to the bank- Returns:
- true if the doorway is already open, false if it had to walk to the nearest bank
-
traverseOpen
public static boolean traverseOpen(BankLocation bank)
Traverses the specified bank location and returns true if it is open, false otherwise.- Parameters:
bank
- the bank location to be traversed- Returns:
- true if the bank location is open, false otherwise
-
traverseOpen
public static boolean traverseOpen(BankLocation bank, WalkCondition condition)
Traverses to the specified bank location if the distance is greater than 10 or the plane is different, and returns whether the bank is successfully opened.- Parameters:
bank
- the bank location to traverse tocondition
- the condition to use for walking- Returns:
- true if the bank is successfully opened, false otherwise
-
getClosestBank
public static BankLocation getClosestBank()
Returns the closest bank location that has requirements.- Returns:
- the closest BankLocation that has requirements, or null if no such location exists
-
close
public static boolean close()
Closes the bank if it is open and the Escape key is pressed, otherwise closes the bank by clicking the "Close" button.- Returns:
- true if the bank is closed successfully, false otherwise.
-
getWithdrawMode
public static BankMode getWithdrawMode()
Returns the mode for withdrawing from the bank.- Returns:
- the BankMode, either ITEM or NOTE
-
setWithdrawMode
public static boolean setWithdrawMode(BankMode mode)
Sets the withdraw mode for the bank.- Parameters:
mode
- the BankMode to set as the withdraw mode- Returns:
- true if the withdraw mode was set successfully, false otherwise
-
getRearrangeMode
public static BankMode getRearrangeMode()
Retrieves the rearrange mode for the bank.- Returns:
- The rearrange mode, either BankMode.SWAP or BankMode.INSERT.
-
setRearrangeMode
public static boolean setRearrangeMode(BankMode mode)
Sets the rearrange mode for the bank.- Parameters:
mode
- the bank mode to set- Returns:
- true if the rearrange mode is set successfully, false otherwise
-
getCurrentBankTab
public static BankTab getCurrentBankTab()
Returns the current bank tab based on the configuration value.- Returns:
- the current bank tab
-
withdraw
public static boolean withdraw(int id, int count)
Withdraws the specified count of money from the account with the given ID.- Parameters:
id
- the ID of the account to withdraw fromcount
- the amount of money to withdraw- Returns:
- true if the withdrawal was successful, false otherwise
-
withdraw
public static boolean withdraw(java.lang.String name, int count)
Withdraws a specified amount from an account.- Parameters:
name
- the name of the account holdercount
- the amount to be withdrawn- Returns:
- true if the withdrawal is successful, false otherwise
-
withdraw
public static boolean withdraw(java.util.function.Predicate<Item> predicate, int count)
Withdraws a specified number of items from the inventory based on a given predicate.- Parameters:
predicate
- the condition to evaluate whether an item should be withdrawncount
- the number of items to withdraw- Returns:
- true if the items were successfully withdrawn, false otherwise
-
withdraw
public static boolean withdraw(int id, int count, boolean noted)
Withdraws the specified count from the given account ID and returns true if successful, false otherwise.- Parameters:
id
- the account ID to withdraw fromcount
- the amount to withdrawnoted
- true if the withdrawal requires a note, false otherwise- Returns:
- true if the withdrawal was executed successfully, false otherwise
-
withdraw
public static boolean withdraw(java.lang.String name, int count, boolean noted)
Withdraws a certain amount from an account with the given name.- Parameters:
name
- the name of the account holdercount
- the amount to withdrawnoted
- true if a note of the withdrawal is required, false otherwise- Returns:
- true if the withdrawal was successfully executed, false otherwise
-
withdraw
public static boolean withdraw(java.util.function.Predicate<Item> predicate, int count, boolean noted)
Withdraws items from a bank based on the given predicate, count, and note preference.- Parameters:
predicate
- the condition for selecting itemscount
- the number of items to withdrawnoted
- whether to withdraw items as notes- Returns:
- true if the withdrawal was successful, false otherwise
-
withdrawAll
public static boolean withdrawAll(int id)
Withdraws all funds from the account with the specified ID.- Parameters:
id
- the ID of the account from which to withdraw funds- Returns:
- true if the withdrawal is executed successfully, false otherwise
-
withdrawAll
public static boolean withdrawAll(java.lang.String name)
Withdraws all items with a specific name from the bank.- Parameters:
name
- the name of the items to be withdrawn- Returns:
- true if the items were successfully withdrawn, false otherwise
-
withdrawAll
public static boolean withdrawAll(java.util.function.Predicate<Item> predicate)
Withdraws all items from the specified inventory that satisfy the given predicate.- Parameters:
predicate
- the condition to check for each item- Returns:
- true if all items were successfully withdrawn, false otherwise
-
withdrawAll
public static boolean withdrawAll(int id, boolean noted)
Withdraws all funds from the specified account.- Parameters:
id
- The account ID to withdraw fromnoted
- True if the withdrawal should be noted, false otherwise- Returns:
- True if the withdrawal was successfully executed, false otherwise
-
withdrawAll
public static boolean withdrawAll(java.lang.String name, boolean noted)
Withdraws all the funds for the specified name, optionally taking note.- Parameters:
name
- the name associated with the accountnoted
- true if a note should be taken, false otherwise- Returns:
- true if the withdrawal was successfully executed, false otherwise
-
withdrawAll
public static boolean withdrawAll(java.util.function.Predicate<Item> predicate, boolean noted)
Withdraws all items from the inventory based on a given predicate, optionally noting them.- Parameters:
predicate
- the condition for selecting items to withdrawnoted
- indicates whether items should be noted or not- Returns:
- true if the withdrawal is successful, false otherwise
-
deposit
public static boolean deposit(int id, int count)
Deposits a specified amount into the account with the given ID.- Parameters:
id
- the ID of the accountcount
- the amount to be deposited- Returns:
- true if the deposit was successful, false otherwise
-
deposit
public static boolean deposit(java.lang.String name, int count)
Creates a deposit event with the given name and count, then executes it.- Parameters:
name
- the name of the deposit eventcount
- the count associated with the deposit event- Returns:
- true if the deposit event was successfully executed, false otherwise
-
deposit
public static boolean deposit(java.util.function.Predicate<Item> predicate, int count)
Executes a deposit event with the given predicate and count.- Parameters:
predicate
- the predicate to determine which items to depositcount
- the number of items to be deposited- Returns:
- true if the deposit event is successfully executed, false otherwise
-
depositAll
public static boolean depositAll(int id)
Deposits all items with specified id into the Inventory.- Parameters:
id
- the id of the items to be deposited- Returns:
- true if all items were deposited successfully, false otherwise
-
depositAll
public static boolean depositAll(java.lang.String name)
Deposits all items with the given name from the player's inventory.- Parameters:
name
- the name of the items to be deposited- Returns:
- true if the items were successfully deposited, false otherwise
-
depositAll
public static boolean depositAll(java.util.function.Predicate<Item> predicate)
Deposits all items from the inventory that satisfy the given predicate.- Parameters:
predicate
- the predicate used to filter the items for deposition- Returns:
- true if all items were deposited successfully, false otherwise
-
depositAllExcept
public static boolean depositAllExcept(java.util.function.Predicate<Item> predicate)
Deposits all items except those that match the given predicate and returns true if all items passed the predicate test.- Parameters:
predicate
- the predicate used to filter the items- Returns:
- true if all items passed the predicate test, otherwise false
-
depositInventory
public static boolean depositInventory()
Executes the deposit inventory event and returns true if it was successfully executed.- Returns:
- true if the deposit inventory event was successfully executed, false otherwise.
-
depositEquipment
public static boolean depositEquipment()
Deposits equipment and returns a boolean indicating if the deposit was successfully executed.- Returns:
- true if the deposit was executed successfully, false otherwise
-
all
public static java.util.List<Item> all(boolean filterPlaceholders)
Returns a List of all non-null and non-zero amount Items from the cache, excluding placeholders if filterPlaceholders is true.- Parameters:
filterPlaceholders
- if true, placeholders will be excluded from the result- Returns:
- the List of filtered Items
-
countAll
public static int countAll(java.util.function.Predicate<Item> predicate)
Returns the total count of the amount from all the items that satisfy the given predicate.- Parameters:
predicate
- the condition to filter the items- Returns:
- the total count of the amount from the filtered items
-
isFull
public static boolean isFull()
Checks if the container is full.- Returns:
- true if the container is full, false otherwise
-
isEmpty
public static boolean isEmpty()
Checks if the container is empty.- Returns:
- true if the container is empty, false otherwise
-
capacity
public static int capacity()
Returns the capacity of the container.- Returns:
- the capacity of the container
-
freeSlots
public static int freeSlots()
Returns the number of free slots in the container.- Returns:
- the number of free slots in the container
-
usedSlots
public static int usedSlots()
Returns the number of used slots in the container.- Returns:
- the number of used slots in the container
-
getFirstEmptySlot
public static int getFirstEmptySlot()
Returns the first empty slot in the container.- Returns:
- the first empty slot in the container
-
getFirstFullSlot
public static int getFirstFullSlot()
Returns the first full slot in the container.- Returns:
- the first full slot in the container
-
get
public static Item get(int id)
Returns the item with the given ID.- Parameters:
id
- the ID of the item- Returns:
- the item with the given ID, or null if no such item exists
-
get
public static Item get(java.lang.String name)
Returns the item with the given name.- Parameters:
name
- the name of the item- Returns:
- the item with the given name, or null if no such item exists
-
get
public static Item get(ItemVariant itemVariant)
Returns the item with the given variant.- Parameters:
itemVariant
- the variant of the item- Returns:
- the item with the given variant, or null if no such item exists
-
get
public static Item get(java.util.function.Predicate<Item> predicate)
Returns the item that satisfies the given predicate.- Parameters:
predicate
- the condition to be satisfied by the item- Returns:
- the item that satisfies the given predicate, or null if no such item exists
-
getForSlot
public static Item getForSlot(int slot)
Returns the item in the given slot.- Parameters:
slot
- the slot of the item- Returns:
- the item in the given slot, or null if no such item exists
-
all
public static java.util.List<Item> all()
Returns a list of all items in the container.- Returns:
- a list of all items in the container
-
all
public static java.util.List<Item> all(int... ids)
Returns a list of all items with the given IDs.- Parameters:
ids
- the IDs of the items- Returns:
- a list of all items with the given IDs
-
all
public static java.util.List<Item> all(java.lang.String... names)
Returns a list of all items with the given names.- Parameters:
names
- the names of the items- Returns:
- a list of all items with the given names
-
all
public static java.util.List<Item> all(Item... items)
Returns a list of all items with the given items.- Parameters:
items
- the items to be returned- Returns:
- a list of all items with the given items
-
all
public static java.util.List<Item> all(ItemVariant itemVariant)
Returns a list of all items with the given variant.- Parameters:
itemVariant
- the variant of the items- Returns:
- a list of all items with the given variant
-
all
public static java.util.List<Item> all(java.util.function.Predicate<Item> predicate)
Returns a list of all items that satisfy the given predicate.- Parameters:
predicate
- the condition to be satisfied by the items- Returns:
- a list of all items that satisfy the given predicate
-
allExcept
public static java.util.List<Item> allExcept(int... ids)
Returns a list of all items except those with the given IDs.- Parameters:
ids
- the IDs of the items to be excluded- Returns:
- a list of all items except those with the given IDs
-
allExcept
public static java.util.List<Item> allExcept(java.lang.String... names)
Returns a list of all items except those with the given names.- Parameters:
names
- the names of the items to be excluded- Returns:
- a list of all items except those with the given names
-
allExcept
public static java.util.List<Item> allExcept(Item... items)
Returns a list of all items except those with the given items.- Parameters:
items
- the items to be excluded- Returns:
- a list of all items except those with the given items
-
allExcept
public static java.util.List<Item> allExcept(ItemVariant itemVariant)
Returns a list of all items except those with the given variant.- Parameters:
itemVariant
- the variant of the items to be excluded- Returns:
- a list of all items except those with the given variant
-
allExcept
public static java.util.List<Item> allExcept(java.util.function.Predicate<Item> predicate)
Returns a list of all items except those that satisfy the given predicate.- Parameters:
predicate
- the condition to be satisfied by the items to be excluded- Returns:
- a list of all items except those that satisfy the given predicate
-
find
public static int find(int... ids)
Returns the first item ID in the container that matches any of the given IDs, or -1 if no such item exists.- Parameters:
ids
- the IDs of the items- Returns:
- the first item ID in the container that matches any of the given IDs, or -1 if no such item exists
-
find
public static int find(int[] ids, int defaultValue)
Returns the first item ID in the container that matches any of the given IDs, or the default value if no such item exists.- Parameters:
ids
- the IDs of the itemsdefaultValue
- the default value to return if no such item exists- Returns:
- the first item ID in the container that matches any of the given IDs, or the default value if no such item exists
-
find
public static int find(ItemVariant variant)
Returns the first item ID in the container that matches the given variant, or -1 if no such item exists.- Parameters:
variant
- the variant of the item- Returns:
- the first item ID in the container that matches the given variant, or -1 if no such item exists
-
find
public static int find(ItemVariant variant, int defaultValue)
Returns the first item ID in the container that matches the given variant, or the default value if no such item exists.- Parameters:
variant
- the variant of the itemdefaultValue
- the default value to return if no such item exists- Returns:
- the first item ID in the container that matches the given variant, or the default value if no such item exists
-
find
public static int find(java.lang.String... names)
Returns the first item ID of an item in the container in which the name matches any of the given names, or -1 if no such item exists.- Parameters:
names
- the names of the items- Returns:
- the first item ID of an item in the container in which the name matches any of the given names, or -1 if no such item exists
-
find
public static int find(java.lang.String[] names, int defaultValue)
Returns the first item ID of an item in the container in which the name matches any of the given names, or the default value if no such item exists.- Parameters:
names
- the names of the itemsdefaultValue
- the default value to return if no such item exists- Returns:
- the first item ID of an item in the container in which the name matches any of the given names, or the default value if no such item exists
-
find
public static int find(java.util.function.Predicate<Item> predicate)
Returns the first item ID in the container that satisfies the given predicate, or -1 if no such item exists.- Parameters:
predicate
- the condition to be satisfied by the item- Returns:
- the first item ID in the container that satisfies the given predicate, or -1 if no such item exists
-
find
public static int find(java.util.function.Predicate<Item> predicate, int defaultValue)
Returns the first item ID in the container that satisfies the given predicate, or the default value if no such item exists.- Parameters:
predicate
- the condition to be satisfied by the itemdefaultValue
- the default value to return if no such item exists- Returns:
- the first item ID in the container that satisfies the given predicate, or the default value if no such item exists
-
findForSlot
public static int findForSlot(int slot)
Returns the item ID in the given slot, or -1 if no such item exists.- Parameters:
slot
- the slot of the item- Returns:
- the item ID in the given slot, or -1 if no such item exists
-
findForSlot
public static int findForSlot(int slot, int defaultValue)
Returns the item ID in the given slot, or the default value if no such item exists.- Parameters:
slot
- the slot of the itemdefaultValue
- the default value to return if no such item exists- Returns:
- the item ID in the given slot, or the default value if no such item exists
-
count
public static int count(int id)
Returns the total amount of items in the container with the given ID.- Parameters:
id
- the ID of the item- Returns:
- the total amount of items in the container with the given ID
-
count
public static int count(int... ids)
Returns the total amount of items in the container with the given IDs.- Parameters:
ids
- the IDs of the items- Returns:
- the total amount of items in the container with the given IDs
-
count
public static int count(java.lang.String name)
Returns the total amount of items in the container with the given name.- Parameters:
name
- the name of the item- Returns:
- the total amount of items in the container with the given name
-
count
public static int count(java.lang.String... names)
Returns the total amount of items in the container with the given names.- Parameters:
names
- the names of the items- Returns:
- the total amount of items in the container with the given names
-
count
public static int count(Item item)
Returns the total amount of items in the container in which the item has the same ID as the given item.- Parameters:
item
- the item- Returns:
- the total amount of items in the container in which the item has the same ID as the given item
-
count
public static int count(Item... items)
Returns the total amount of items in the container in which the item has the same ID as the given items.- Parameters:
items
- the items- Returns:
- the total amount of items in the container in which the item has the same ID as the given items
-
count
public static int count(ItemVariant itemVariant)
Returns the total amount of items in the container in which the item matches the variant.- Parameters:
itemVariant
- the variant of the item- Returns:
- the total amount of items in the container in which the item matches the variant
-
count
public static int count(java.util.function.Predicate<Item> predicate)
Returns the total amount of items in the container that satisfy the given predicate.- Parameters:
predicate
- the condition to be satisfied by the items- Returns:
- the total amount of items in the container that satisfy the given predicate
-
contains
public static boolean contains(int id)
Checks if the container contains an item with the given ID.- Parameters:
id
- the ID of the item- Returns:
- true if the container contains an item with the given ID, false otherwise
-
contains
public static boolean contains(int... ids)
Checks if the container contains items with the given IDs.- Parameters:
ids
- the IDs of the items- Returns:
- true if the container contains items with the given IDs, false otherwise
-
contains
public static boolean contains(java.lang.String name)
Checks if the container contains an item with the given name.- Parameters:
name
- the name of the item- Returns:
- true if the container contains an item with the given name, false otherwise
-
contains
public static boolean contains(java.lang.String... names)
Checks if the container contains items with the given names.- Parameters:
names
- the names of the items- Returns:
- true if the container contains items with the given names, false otherwise
-
contains
public static boolean contains(Item item)
Checks if the container contains the given item.- Parameters:
item
- the item- Returns:
- true if the container contains the given item, false otherwise
-
contains
public static boolean contains(Item... items)
Checks if the container contains the given items.- Parameters:
items
- the items- Returns:
- true if the container contains the given items, false otherwise
-
contains
public static boolean contains(ItemVariant itemVariant)
Checks if the container contains the given item variant.- Parameters:
itemVariant
- the variant of the item- Returns:
- true if the container contains the given item variant, false otherwise
-
contains
public static boolean contains(java.util.function.Predicate<Item> predicate)
Checks if the container contains an item that satisfies the given predicate.- Parameters:
predicate
- the condition to be satisfied by the item- Returns:
- true if the container contains an item that satisfies the given predicate, false otherwise
-
containsAll
public static boolean containsAll(int id)
Checks if the container contains all items with the given ID.- Parameters:
id
- the ID of the item- Returns:
- true if the container contains all items with the given ID, false otherwise
-
containsAll
public static boolean containsAll(int... ids)
Checks if the container contains all items with the given IDs.- Parameters:
ids
- the IDs of the items- Returns:
- true if the container contains all items with the given IDs, false otherwise
-
containsAll
public static boolean containsAll(java.lang.String name)
Checks if the container contains all items with the given name.- Parameters:
name
- the name of the item- Returns:
- true if the container contains all items with the given name, false otherwise
-
containsAll
public static boolean containsAll(java.lang.String... names)
Checks if the container contains all items with the given names.- Parameters:
names
- the names of the items- Returns:
- true if the container contains all items with the given names, false otherwise
-
containsAll
public static boolean containsAll(Item item)
Checks if the container contains all items with the given item.- Parameters:
item
- the item- Returns:
- true if the container contains all items with the given item, false otherwise
-
containsAll
public static boolean containsAll(Item... items)
Checks if the container contains all items with the given items.- Parameters:
items
- the items- Returns:
- true if the container contains all items with the given items, false otherwise
-
containsAll
public static boolean containsAll(ItemVariant itemVariant)
Checks if the container contains all items with the given item variant.- Parameters:
itemVariant
- the variant of the item- Returns:
- true if the container contains all items with the given item variant, false otherwise
-
containsAll
public static boolean containsAll(java.util.function.Predicate<Item> predicate)
Checks if the container contains all items that satisfy the given predicate.- Parameters:
predicate
- the condition to be satisfied by the items- Returns:
- true if the container contains all items that satisfy the given predicate, false otherwise
-
onlyContains
public static boolean onlyContains(int id)
Checks if the container only contains an item with the given ID.- Parameters:
id
- the ID of the item- Returns:
- true if the container only contains an item with the given ID, false otherwise
-
onlyContains
public static boolean onlyContains(int... ids)
Checks if the container only contains items with the given IDs.- Parameters:
ids
- the IDs of the items- Returns:
- true if the container only contains items with the given IDs, false otherwise
-
onlyContains
public static boolean onlyContains(java.lang.String name)
Checks if the container only contains an item with the given name.- Parameters:
name
- the name of the item- Returns:
- true if the container only contains an item with the given name, false otherwise
-
onlyContains
public static boolean onlyContains(java.lang.String... names)
Checks if the container only contains items with the given names.- Parameters:
names
- the names of the items- Returns:
- true if the container only contains items with the given names, false otherwise
-
onlyContains
public static boolean onlyContains(Item item)
Checks if the container only contains the given item.- Parameters:
item
- the item- Returns:
- true if the container only contains the given item, false otherwise
-
onlyContains
public static boolean onlyContains(Item... items)
Checks if the container only contains the given items.- Parameters:
items
- the items- Returns:
- true if the container only contains the given items, false otherwise
-
onlyContains
public static boolean onlyContains(ItemVariant itemVariant)
Checks if the container only contains the given item variant.- Parameters:
itemVariant
- the variant of the item- Returns:
- true if the container only contains the given item variant, false otherwise
-
onlyContains
public static boolean onlyContains(java.util.function.Predicate<Item> predicate)
Checks if the container only contains items that satisfy the given predicate.- Parameters:
predicate
- the condition to be satisfied by the items- Returns:
- true if the container only contains items that satisfy the given predicate, false otherwise
-
-