Inventory
INFO
See also: itemstack for ItemStack properties.
click
Clicks a slot in the current container.
java
inventory.click(int slot, int button, int mode);getBookContents
Returns the pages of the currently open book as raw JSON strings.
java
List<String> pages = inventory.getBookContents();getChest
Returns the chest name when a chest is open, otherwise an empty string.
java
String chestName = inventory.getChest();getChestSize
Returns the size of the opened chest inventory, or 0 if no chest is open.
java
int chestSize = inventory.getChestSize();getContainer
Returns the simple class name of the currently open container.
java
String container = inventory.getContainer();getSize
Returns the size of the player's inventory.
java
int size = inventory.getSize();getSlot
Returns the currently selected hotbar slot index.
java
int slot = inventory.getSlot();getStackInChestSlot
Returns the item in the specified chest slot as an ItemStack, or null when unavailable.
java
ItemStack item = inventory.getStackInChestSlot(int slot);getStackInSlot
Returns the item in the specified player inventory slot as an ItemStack.
java
ItemStack item = inventory.getStackInSlot(int slot);open
Simulates opening the inventory GUI.
java
inventory.open();setSlot
Sets the currently selected hotbar slot.
java
inventory.setSlot(int slot);