Class Inventory
- java.lang.Object
-
- org.dreambot.api.methods.container.impl.Inventory
-
public class Inventory extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
SLOT_HEIGHT
static int
SLOT_WIDTH
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(int index, Item t)
Adds an item manually to the inventory collection at the given index Not recommended unless you know what you're doingstatic boolean
add(Item t)
Adds an item manually to the Inventory collection Not recommended unless you know what you're doing.static @NonNull java.util.List<@Nullable Item>
all()
Gets the items in your inventorystatic @NonNull java.util.List<Item>
all(@NonNull Filter<Item> filter)
A list of all the items.static int
capacity()
Returns the capacity of your inventory (28)static boolean
combine(int primaryItemId, int secondaryItemId)
static boolean
combine(@NonNull java.lang.String primaryItemName, @NonNull java.lang.String secondaryItemName)
static boolean
combine(@NonNull Item primary, @NonNull Item secondary)
static boolean
contains(int id)
Contains boolean.static boolean
contains(int[] ids)
static boolean
contains(@NonNull java.lang.String string)
Determines if collection contains item with specified name.static boolean
contains(@NonNull java.lang.String... names)
Checks if your collection contains one item which meets one of the specified names.static boolean
contains(@NonNull Filter<Item> filter)
Checks if your collection contains one item which meets the specified filter.static boolean
contains(@Nullable java.lang.Object o)
static boolean
contains(java.lang.Integer... ids)
Checks if your collection contains one item which meets one of the specified ids.static boolean
containsAll(int... ids)
Checks if your Inventory contains all of the items with specified IDsstatic boolean
containsAll(@NonNull java.lang.String... names)
Checks if your Inventory contains all of the items with names specifiedstatic boolean
containsAll(@NonNull java.util.Collection<?> collection)
Checks if your collection contains all of the items in the collectionsstatic int
count(int id)
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 Filter<Item> filter)
Count of all the items that match the search.static boolean
deselect()
Deselects any item if it is selectedstatic boolean
drag(int itemId, int toSlot)
This will move the first matching item in the inventory to the provided slot.static boolean
drag(@NonNull java.lang.String itemName, int toSlot)
This will move the first matching item in the inventory to the provided slot.static boolean
drag(@NonNull Filter<Item> itemFilter, int toSlot)
This will move the first matching item in the inventory to the provided slot.static boolean
drag(@NonNull Item item, int toSlot)
This will move the first matching item in the inventory to the provided slot.static boolean
drop(int id)
Drops the item with specified ID from inventorystatic boolean
drop(@NonNull java.lang.String name)
Drops the item with specified name from Inventorystatic boolean
drop(@NonNull Filter<Item> filter)
Drops the item matching specified Filter from Inventorystatic boolean
dropAll()
Drops all items in your inventory.static boolean
dropAll(int id)
Drops all items in your inventory matching specified IDstatic boolean
dropAll(int[] ids)
static boolean
dropAll(@NonNull java.lang.String name)
Drops all items in your inventory matching specified namestatic boolean
dropAll(@NonNull java.lang.String... names)
Drops all items in your inventory matching specified names.static boolean
dropAll(@NonNull Filter<Item> filter)
Drops all items in your inventory matching the specified filterstatic boolean
dropAll(java.lang.Integer... ids)
Drops all items in your inventory matching specified id'sstatic boolean
dropAllExcept(int[] ids)
static boolean
dropAllExcept(@NonNull java.lang.String... names)
Drops all items that don't match the given namesstatic boolean
dropAllExcept(@NonNull Filter<Item> filter)
Drops all items that are not filtered.static boolean
dropAllExcept(java.lang.Integer... ids)
Drops all items that don't match the given ID'sstatic int
emptySlotCount()
Empty slot count.static @NonNull java.util.List<Item>
except(@NonNull Filter<Item> filter)
Get all items which do not fit the given criteria.static int
fullSlotCount()
Full slot count.static @Nullable Item
get(int id)
Gets the first item that matches the given item IDstatic @Nullable Item
get(int[] ids)
static @Nullable Item
get(@NonNull java.lang.String name)
Get item for specified name.static @Nullable Item
get(@NonNull java.lang.String... names)
static @Nullable Item
get(java.lang.Integer... ids)
Gets the first item that matches one of the given IDsstatic @Nullable Item
get(Filter<Item> filter)
static @NonNull java.lang.String[]
getActionsForSlot(int slot)
static @NonNull DropPattern
getDropPattern()
Gets the dropping pattern fordropAll(Filter)
Defaults toStandardDropPattern.LEFT_TO_RIGHT_THEN_DOWN
static int
getEmptySlots()
Gets the count of empty slots in your inventorystatic int
getFirstEmptySlot()
Gets the first empty slot in your inventory.static int
getFirstFullSlot()
Gets the next full slot in your inventorystatic int
getIdForSlot(int slot)
Gets the Id of the Item in the slot.static WidgetChild
getInventoryWidget()
Gets the basic inventory widget Basic meaning bank not open, ge not open, shop not open, etcstatic @Nullable Item
getItemInSlot(int index)
Gets item in specified slot.static @Nullable java.lang.String
getNameForSlot(int slot)
Gets the Name for the Item in the slot.static @Nullable Item
getRandom(int... itemIDs)
Gets a random item that matches the item id(s) in your inventorystatic @Nullable Item
getRandom(@NonNull java.lang.String... itemNames)
Gets a random item that matches the item name(s) in your inventorystatic @Nullable Item
getRandom(@NonNull Filter<Item> itemFilter)
Gets a random item that matches the item filter in your inventorystatic int
getSelectedItemId()
Gets the ID of the currently selected item.static int
getSelectedItemIndex()
Gets the index of the currently selected item.static @Nullable java.lang.String
getSelectedItemName()
Gets the currently selected item namestatic @Nullable WidgetChild
getWidgetForSlot(int slot)
static @Nullable WidgetChild
getWidgetForSlot(int slot, @Nullable java.lang.String action)
static boolean
interact(int id)
Interact with an Item with specified ID in inventory using the first available actionstatic boolean
interact(int id, @Nullable java.lang.String action)
Interact with an Item with specified ID in inventorystatic boolean
interact(@NonNull java.lang.String name)
Interact with the Item with specified name in Inventory using the first available actionstatic boolean
interact(@NonNull java.lang.String name, @Nullable java.lang.String action)
Interact with the Item with specified name in Inventorystatic boolean
interact(@NonNull Filter<Item> filter)
Interact with an Item with specified ID in inventory using the first available actionstatic boolean
interact(@NonNull Filter<Item> filter, @Nullable java.lang.String action)
Interact with an Item with specified ID in inventorystatic boolean
interact(@NonNull Item item)
Interacts with a given Item with a specified action using the first available action If Item has an invalid slot value, it will find slot based on item idstatic boolean
interact(@NonNull Item item, @Nullable java.lang.String action)
Interacts with a given Item with a specified action If Item has an invalid slot value, it will find slot based on item idstatic boolean
isEmpty()
static boolean
isForceNoShift()
Forces the inventory to ignore whether shift interactions are enabled or notstatic boolean
isFull()
Determines if container full.static boolean
isItemSelected()
Checks whether an item is currently selected in your inventorystatic boolean
isLoaded()
Checks if the Inventory Item Table has been successfully loaded within the client through ourall()
callstatic boolean
isOpen()
static boolean
isSlotEmpty(int slot)
Checks if the given slot has an item in it or notstatic boolean
isSlotFull(int slot)
Checks if the slot has an Item in itstatic @NonNull java.awt.Rectangle
itemBounds(Item item)
Gets the slot bounds of an item.static boolean
onlyContains(int[] id)
static boolean
onlyContains(@NonNull java.lang.String... names)
Checks if your Inventory only contains items with specified namestatic boolean
onlyContains(@NonNull Filter<Item> f)
Checks if your Inventory only contains items that match the Filterstatic boolean
onlyContains(java.lang.Integer... id)
Checks if your Inventory only contains items with specified IDstatic boolean
open()
static @Nullable Item
set(int index, @Nullable Item element)
static void
setDropPattern(@NonNull DropPattern dropPattern)
Sets the dropping pattern fordropAll(Filter)
static void
setForceNoShift(boolean forceNoShift)
Sets inventory to force no shift during droppingstatic void
setSelectedWidgetItemId(int id)
static boolean
shouldShift()
Checks whether shift needs to be pressed for shift interactions Only implemented for dropping purposesstatic int
size()
static int
slot(int id)
Gets the slot for the item with specified ID.static int
slot(@NonNull java.lang.String name)
Gets the slot for the item with specified name.static int
slot(@NonNull Filter<Item> filter)
Gets the slot for the item with specified name.static @NonNull java.awt.Rectangle
slotBounds(int slot)
Gets the bounds of a slotstatic boolean
slotContains(int slot, int[] ids)
static boolean
slotContains(int slot, @NonNull java.lang.Integer... ids)
Checks if the slot contains items that matches the given ids.static 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 items that matches the filter.static boolean
slotContains(int slot, @NonNull Item t)
Checks if the slot contains items that matches the given ids.static boolean
slotInteract(int slot)
Interacts with specified slot in inventory using the first available actionstatic boolean
slotInteract(int slot, @Nullable java.lang.String action)
Interacts with specified slot in inventorystatic boolean
slotNameContains(int slot, @NonNull java.lang.String sub)
Checks if the slot contains items that matches the given ids.static boolean
swap(int fromSlot, int toSlot)
Swaps the contents of two inventory slots, either of which can be empty to simply move an item from one to the otherstatic boolean
swap(@NonNull Item firstItem, @NonNull Item secondItem)
Swaps the first of each item given if found, if you want to swap specific slots useswap(int, int)
insteadstatic @Nullable Item @NonNull []
toArray()
Convertsall()
to an Item arraystatic boolean
use(int id)
static boolean
use(@NonNull java.lang.String name)
static boolean
use(@NonNull Item item)
static int
widgetChildId()
Gets the basic inventory widget child ID Basic meaning bank not open, ge not open, shop not open, etcstatic int
widgetParentId()
Gets the basic inventory widget parent ID Basic meaning bank not open, GE not open, shop not open, etc
-
-
-
Field Detail
-
SLOT_WIDTH
public static final int SLOT_WIDTH
- See Also:
- Constant Field Values
-
SLOT_HEIGHT
public static final int SLOT_HEIGHT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDropPattern
public static @NonNull DropPattern getDropPattern()
Gets the dropping pattern fordropAll(Filter)
Defaults toStandardDropPattern.LEFT_TO_RIGHT_THEN_DOWN
- Returns:
-
setDropPattern
public static void setDropPattern(@NonNull DropPattern dropPattern)
Sets the dropping pattern fordropAll(Filter)
- Parameters:
dropPattern
- SeeStandardDropPattern
for basic options or create your own
-
widgetParentId
public static int widgetParentId()
Gets the basic inventory widget parent ID Basic meaning bank not open, GE not open, shop not open, etc
-
widgetChildId
public static int widgetChildId()
Gets the basic inventory widget child ID Basic meaning bank not open, ge not open, shop not open, etc
-
capacity
public static int capacity()
Returns the capacity of your inventory (28)
-
getInventoryWidget
public static WidgetChild getInventoryWidget()
Gets the basic inventory widget Basic meaning bank not open, ge not open, shop not open, etc
-
all
public static @NonNull java.util.List<@Nullable Item> all()
Gets the items in your inventory- Returns:
- list of all items in your inventory.
-
isLoaded
public static boolean isLoaded()
Checks if the Inventory Item Table has been successfully loaded within the client through ourall()
call
-
slotInteract
public static boolean slotInteract(int slot, @Nullable java.lang.String action)
Interacts with specified slot in inventory- Parameters:
slot
- Slot to interact withaction
- Action to use in interacting- Returns:
- True if interaction was successful, else False
-
slotInteract
public static boolean slotInteract(int slot)
Interacts with specified slot in inventory using the first available action- Parameters:
slot
- Slot to interact with- Returns:
- True if interaction was successful, else False
-
deselect
public static boolean deselect()
Deselects any item if it is selected- Returns:
- True if succeeded
-
interact
public static boolean interact(int id, @Nullable java.lang.String action)
Interact with an Item with specified ID in inventory- Parameters:
id
- Item ID to interact withaction
- Action to use in interacting- Returns:
- True if interaction was successful, else False
-
interact
public static boolean interact(int id)
Interact with an Item with specified ID in inventory using the first available action- Parameters:
id
- Item ID to interact with- Returns:
- True if interaction was successful, else False
-
interact
public static boolean interact(@NonNull Filter<Item> filter, @Nullable java.lang.String action)
Interact with an Item with specified ID in inventory- Parameters:
filter
- Item ID to interact withaction
- Action to use in interacting- Returns:
- True if interaction was successful, else False
-
interact
public static boolean interact(@NonNull Filter<Item> filter)
Interact with an Item with specified ID in inventory using the first available action- Parameters:
filter
- Item ID to interact with- Returns:
- True if interaction was successful, else False
-
interact
public static boolean interact(@NonNull java.lang.String name, @Nullable java.lang.String action)
Interact with the Item with specified name in Inventory- Parameters:
name
- Name of item to interact withaction
- Action to use in interacting- Returns:
- True if interaction was successful, else False
-
interact
public static boolean interact(@NonNull java.lang.String name)
Interact with the Item with specified name in Inventory using the first available action- Parameters:
name
- Name of item to interact with- Returns:
- True if interaction was successful, else False
-
interact
public static boolean interact(@NonNull Item item, @Nullable java.lang.String action)
Interacts with a given Item with a specified action If Item has an invalid slot value, it will find slot based on item id- Parameters:
item
- Item to interact withaction
- action to interact with- Returns:
- false if item is null, else see
slotInteract(int, String)
-
interact
public static boolean interact(@NonNull Item item)
Interacts with a given Item with a specified action using the first available action If Item has an invalid slot value, it will find slot based on item id- Parameters:
item
- Item to interact with- Returns:
- false if item is null, else see
slotInteract(int, String)
-
drop
public static boolean drop(int id)
Drops the item with specified ID from inventory- Parameters:
id
- ID of item to drop- Returns:
- True if interaction was successful, else False
-
drop
public static boolean drop(@NonNull java.lang.String name)
Drops the item with specified name from Inventory- Parameters:
name
- Name of item to drop- Returns:
- True if interaction was successful, else False
-
drop
public static boolean drop(@NonNull Filter<Item> filter)
Drops the item matching specified Filter from Inventory- Parameters:
filter
-- Returns:
-
dropAll
public static boolean dropAll()
Drops all items in your inventory.- Returns:
- true if all items were dropped
-
dropAll
public static boolean dropAll(int id)
Drops all items in your inventory matching specified ID- Parameters:
id
- Id of item to drop all of- Returns:
- true if all items matching the id were dropped
-
dropAll
public static boolean dropAll(@NonNull java.lang.String name)
Drops all items in your inventory matching specified name- Parameters:
name
- name of item to drop all of.- Returns:
- is all of item matching description was dropped.
-
dropAll
public static boolean dropAll(java.lang.Integer... ids)
Drops all items in your inventory matching specified id's- Parameters:
ids
- id's of items you want to drop all of.- Returns:
- returns true if the inventory doesn't contain any matching items after we've dropped them if necessary
-
dropAll
public static boolean dropAll(int[] ids)
-
dropAll
public static boolean dropAll(@NonNull java.lang.String... names)
Drops all items in your inventory matching specified names.- Parameters:
names
- names of items you want to drop all of- Returns:
- returns true if the inventory doesn't contain any matching items after we've dropped them if necessary
-
dropAll
public static boolean dropAll(@NonNull Filter<Item> filter)
Drops all items in your inventory matching the specified filter- Parameters:
filter
- Filter to match any items you want to drop all of- Returns:
- returns true if the inventory doesn't contain any matching items after we've dropped them if necessary
-
dropAllExcept
public static boolean dropAllExcept(@NonNull java.lang.String... names)
Drops all items that don't match the given names- Parameters:
names
- Names of items to not drop
-
dropAllExcept
public static boolean dropAllExcept(java.lang.Integer... ids)
Drops all items that don't match the given ID's- Parameters:
ids
- IDs to not drop
-
dropAllExcept
public static boolean dropAllExcept(int[] ids)
-
dropAllExcept
public static boolean dropAllExcept(@NonNull Filter<Item> filter)
Drops all items that are not filtered.- Parameters:
filter
- the filter which excludes items from dropping.
-
itemBounds
public static @NonNull java.awt.Rectangle itemBounds(Item item)
Gets the slot bounds of an item.- Parameters:
item
- Item to get bounds of.- Returns:
- Rectangle of Item slot.
-
slotBounds
public static @NonNull java.awt.Rectangle slotBounds(int slot)
Gets the bounds of a slot- Parameters:
slot
- Slot to get bounds of- Returns:
- Rectangle of the slot
-
isItemSelected
public static boolean isItemSelected()
Checks whether an item is currently selected in your inventory- Returns:
- True if an item is selected, else false
-
getSelectedItemName
public static @Nullable java.lang.String getSelectedItemName()
Gets the currently selected item name- Returns:
- currently selected item name if no item name selected then null
-
getSelectedItemIndex
public static int getSelectedItemIndex()
Gets the index of the currently selected item.- Returns:
- Integer value of currently selected item index, or if no item selected -1
-
getSelectedItemId
public static int getSelectedItemId()
Gets the ID of the currently selected item.- Returns:
- ID of the currently selected item, or if no item selected -1
-
setSelectedWidgetItemId
public static void setSelectedWidgetItemId(int id)
-
getEmptySlots
public static int getEmptySlots()
Gets the count of empty slots in your inventory- Returns:
- number of empty slots in your inventory
-
getRandom
public static @Nullable Item getRandom(@NonNull java.lang.String... itemNames)
Gets a random item that matches the item name(s) in your inventory- Parameters:
itemNames
- Name(s) of the item(s)- Returns:
- Random Item that matches
-
getRandom
public static @Nullable Item getRandom(int... itemIDs)
Gets a random item that matches the item id(s) in your inventory- Parameters:
itemIDs
- ID(s) of the item(s)- Returns:
- Random Item that matches
-
getRandom
public static @Nullable Item getRandom(@NonNull Filter<Item> itemFilter)
Gets a random item that matches the item filter in your inventory- Parameters:
itemFilter
- Filter for the item you want to get- Returns:
- Random item that matches the filter
-
isForceNoShift
public static boolean isForceNoShift()
Forces the inventory to ignore whether shift interactions are enabled or not
-
setForceNoShift
public static void setForceNoShift(boolean forceNoShift)
Sets inventory to force no shift during dropping
-
shouldShift
public static boolean shouldShift()
Checks whether shift needs to be pressed for shift interactions Only implemented for dropping purposes- Returns:
- !
isForceNoShift()
&&ClientSettings.isShiftClickDroppingEnabled()
()} && !Keyboard.isHeld(Key)
} withKey.SHIFT
-
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)
Checks if the given slot has an item in it or not- Parameters:
slot
- slot to check (0-27)- Returns:
- True if there is no item in the slot, else false
-
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(@NonNull java.lang.String... names)
Checks if your Inventory only contains items with specified name- Parameters:
names
- Names of items to look for- Returns:
- True if Inventory only contains items with that name, else False
-
onlyContains
public static boolean onlyContains(java.lang.Integer... id)
Checks if your Inventory only contains items with specified ID- Parameters:
id
- IDs of items to check for- Returns:
- True if Inventory only contains items with specified ID, else False
-
onlyContains
public static boolean onlyContains(int[] id)
-
onlyContains
public static boolean onlyContains(@NonNull Filter<Item> f)
Checks if your Inventory only contains items that match the Filter- Parameters:
f
- Filter to pass items through- Returns:
- True if Inventory only contains items matching Filter, else False, also returns False if Inventory is empty
-
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 Inventory only contains items matching Filter, else false
-
slotNameContains
public static boolean slotNameContains(int slot, @NonNull 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 Inventory only contains items matching Filter, else false.
-
slotContains
public static boolean slotContains(int slot, @NonNull java.lang.Integer... ids)
Checks if the slot contains items that matches the given ids.- Parameters:
ids
- ids of the items to check.- Returns:
- True if Inventory only contains items matching Filter, 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 items that matches the given ids.- Parameters:
t
- The object to check.- Returns:
- True if Inventory only contains items matching Filter, else false.
-
slotContains
public static boolean slotContains(int slot, @NonNull Filter<Item> filter)
Checks if the slot contains items that matches the filter.- Parameters:
filter
- Filter to pass items through.- Returns:
- True if Inventory only contains items matching Filter, else false.
-
getFirstEmptySlot
public static int getFirstEmptySlot()
Gets the first empty slot in your inventory.- Returns:
- slot number, if inventory is full -1.
-
getFirstFullSlot
public static int getFirstFullSlot()
Gets the next full slot in your inventory- Returns:
- slot number, if inventory 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 @Nullable 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(@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
public static int slot(@NonNull Filter<Item> filter)
Gets the slot for the item with specified name.- Parameters:
filter
- filter of the item to get slot of.- Returns:
- Item slot or -1 if Item is null.
-
add
public static boolean add(Item t)
Adds an item manually to the Inventory collection Not recommended unless you know what you're doing.
-
add
public static void add(int index, Item t)
Adds an item manually to the inventory collection at the given index Not recommended unless you know what you're doing
-
all
public static @NonNull java.util.List<Item> all(@NonNull Filter<Item> filter)
A list of all the items.- Parameters:
filter
- the filter to search with.- Returns:
- the list of all filtered items.
-
getItemInSlot
public static @Nullable Item getItemInSlot(int index)
Gets item in specified slot.- Parameters:
index
- the index.- Returns:
- the item in slot.
-
get
public static @Nullable Item get(int id)
Gets the first item that matches the given item ID- Parameters:
id
- item ID to get- Returns:
- First item that matches the given item ID, else null
-
get
public static @Nullable Item get(java.lang.Integer... ids)
Gets the first item that matches one of the given IDs- Parameters:
ids
- Integer varargs for ID's to look for- Returns:
- the first item that matches any of the given ID's
-
get
public static @Nullable Item get(int[] ids)
-
get
public static @Nullable Item get(@NonNull java.lang.String name)
Get 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)
-
except
public static @NonNull java.util.List<Item> except(@NonNull 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)
Contains boolean.- Parameters:
id
- the id- Returns:
- the boolean
-
contains
public static boolean contains(@NonNull java.lang.String string)
Determines if collection contains item with specified name.- Parameters:
string
- the name of the item.- Returns:
- true if collection contains item, otherwise false.
-
containsAll
public static boolean containsAll(@NonNull java.lang.String... names)
Checks if your Inventory contains all of the items with names specified- Parameters:
names
- Names of items to check for- Returns:
- True if Inventory contains all names, else False
-
containsAll
public static boolean containsAll(int... ids)
Checks if your Inventory contains all of the items with specified IDs- Parameters:
ids
- IDs of items to check for- Returns:
- True if Inventory contains all IDs, else false.
-
containsAll
public static boolean containsAll(@NonNull java.util.Collection<?> collection)
Checks if your collection contains all of the items in the collections- Parameters:
collection
- The collection of items to compare against- Returns:
- True if inventory 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(@NonNull 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(@NonNull Filter<Item> filter)
Checks if your collection contains one item which meets the specified filter.- Parameters:
filter
- the filter to search with.- Returns:
- true if contains one of, else false.
-
contains
public static boolean contains(@Nullable java.lang.Object o)
-
isFull
public static boolean isFull()
Determines if container full.- Returns:
- the boolean
-
count
public static int count(@NonNull 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(@NonNull 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.
-
getWidgetForSlot
public static @Nullable WidgetChild getWidgetForSlot(int slot)
-
getWidgetForSlot
public static @Nullable WidgetChild getWidgetForSlot(int slot, @Nullable java.lang.String action)
-
isOpen
public static boolean isOpen()
-
open
public static boolean open()
-
use
public static boolean use(int id)
-
use
public static boolean use(@NonNull java.lang.String name)
-
use
public static boolean use(@NonNull Item item)
-
combine
public static boolean combine(@NonNull java.lang.String primaryItemName, @NonNull java.lang.String secondaryItemName)
-
combine
public static boolean combine(int primaryItemId, int secondaryItemId)
-
drag
public static boolean drag(@NonNull Filter<Item> itemFilter, int toSlot)
This will move the first matching item in the inventory to the provided slot. This will only move the first found item in the inventory, if you want to move a specific item to the slot, seeswap(int, int)
instead.- Parameters:
itemFilter
- the item filter to be used to find a matching inventory itemtoSlot
- the slot where the item should end up- Returns:
- true if we move the item successfully or if it's already there
-
drag
public static boolean drag(@NonNull java.lang.String itemName, int toSlot)
This will move the first matching item in the inventory to the provided slot. This will only move the first found item in the inventory, if you want to move a specific item to the slot, seeswap(int, int)
instead.- Parameters:
itemName
- the item name to be movedtoSlot
- the slot where the item should end up- Returns:
- true if we move the item successfully or if it's already there
-
drag
public static boolean drag(int itemId, int toSlot)
This will move the first matching item in the inventory to the provided slot. This will only move the first found item in the inventory, if you want to move a specific item to the slot, seeswap(int, int)
instead.- Parameters:
itemId
- the item id to be movedtoSlot
- the slot where the item should end up- Returns:
- true if we move the item successfully or if it's already there
-
drag
public static boolean drag(@NonNull Item item, int toSlot)
This will move the first matching item in the inventory to the provided slot. This will only move the first found item in the inventory, if you want to move a specific item to the slot, seeswap(int, int)
instead.- Parameters:
item
- the item to be movedtoSlot
- the slot where the item should end up- Returns:
- true if we move the item successfully or if it's already there
-
swap
public static boolean swap(@NonNull Item firstItem, @NonNull Item secondItem)
Swaps the first of each item given if found, if you want to swap specific slots useswap(int, int)
instead- Parameters:
firstItem
- the first itemsecondItem
- the second item- Returns:
- true if both items are found, aren't the same, and are successfully swapped
-
swap
public static boolean swap(int fromSlot, int toSlot)
Swaps the contents of two inventory slots, either of which can be empty to simply move an item from one to the other- Parameters:
fromSlot
- the start inventory slottoSlot
- the end inventory slot- Returns:
- true if the items are swapped successfully or if both slots are the same, false otherwise
-
getActionsForSlot
public static @NonNull java.lang.String[] getActionsForSlot(int slot)
-
-