Package net.william278.husksync.data
Class BukkitInventoryMap
java.lang.Object
net.william278.husksync.data.BukkitInventoryMap
A mapped player inventory, providing methods to easily access a player's inventory.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
BukkitInventoryMap(org.bukkit.inventory.ItemStack[] contents)
Creates a new mapped inventory from the given contents. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStack[]
getArmor()
Optional<org.bukkit.inventory.ItemStack>
getBoots()
Optional<org.bukkit.inventory.ItemStack>
org.bukkit.inventory.ItemStack[]
Gets the contents of the inventory.Optional<org.bukkit.inventory.ItemStack>
org.bukkit.inventory.ItemStack[]
org.bukkit.inventory.ItemStack[]
Returns the main inventory contents.Optional<org.bukkit.inventory.ItemStack>
getItemAt(int index)
Gets the item at the given index.Optional<org.bukkit.inventory.ItemStack>
Optional<org.bukkit.inventory.ItemStack>
int
getSize()
Gets the size of the inventory.void
setContents(org.bukkit.inventory.ItemStack[] contents)
Set the contents of the inventory.void
setItemAt(org.bukkit.inventory.ItemStack itemStack, int index)
Sets the item at the given index.
-
Field Details
-
INVENTORY_SLOT_COUNT
public static final int INVENTORY_SLOT_COUNT- See Also:
- Constant Field Values
-
-
Constructor Details
-
BukkitInventoryMap
protected BukkitInventoryMap(org.bukkit.inventory.ItemStack[] contents)Creates a new mapped inventory from the given contents.- Parameters:
contents
- the contents of the inventory
-
-
Method Details
-
getContents
public org.bukkit.inventory.ItemStack[] getContents()Gets the contents of the inventory.- Returns:
- the contents of the inventory
-
setContents
public void setContents(org.bukkit.inventory.ItemStack[] contents)Set the contents of the inventory.- Parameters:
contents
- the contents of the inventory
-
getSize
public int getSize()Gets the size of the inventory.- Returns:
- the size of the inventory
-
getItemAt
Gets the item at the given index.- Parameters:
index
- the index of the item to get- Returns:
- the item at the given index
-
setItemAt
public void setItemAt(@NotNull org.bukkit.inventory.ItemStack itemStack, int index) throws IllegalArgumentExceptionSets the item at the given index.- Parameters:
itemStack
- the item to set at the given indexindex
- the index of the item to set- Throws:
IllegalArgumentException
- if the index is out of bounds
-
getInventory
public org.bukkit.inventory.ItemStack[] getInventory()Returns the main inventory contents.- Returns:
- the main inventory contents
-
getHotbar
public org.bukkit.inventory.ItemStack[] getHotbar() -
getOffHand
-
getHelmet
-
getChestplate
-
getLeggings
-
getBoots
-
getArmor
public org.bukkit.inventory.ItemStack[] getArmor()
-