Class BukkitInventoryMap

java.lang.Object
net.william278.husksync.data.BukkitInventoryMap

public class BukkitInventoryMap extends Object
A mapped player inventory, providing methods to easily access a player's inventory.
  • Field Details

  • 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

      public Optional<org.bukkit.inventory.ItemStack> getItemAt(int index)
      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 IllegalArgumentException
      Sets the item at the given index.
      Parameters:
      itemStack - the item to set at the given index
      index - 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

      public Optional<org.bukkit.inventory.ItemStack> getOffHand()
    • getHelmet

      public Optional<org.bukkit.inventory.ItemStack> getHelmet()
    • getChestplate

      public Optional<org.bukkit.inventory.ItemStack> getChestplate()
    • getLeggings

      public Optional<org.bukkit.inventory.ItemStack> getLeggings()
    • getBoots

      public Optional<org.bukkit.inventory.ItemStack> getBoots()
    • getArmor

      public org.bukkit.inventory.ItemStack[] getArmor()