Interface SpielerInventar

All Superinterfaces:
Inventar, Iterable<GegenstandsStapel>

public interface SpielerInventar extends Inventar
Interface to the inventar of a Spieler, including the four armor slots and any extra slots.
  • Method Details

    • getArmorContents

      @NotNull GegenstandsStapel[] getArmorContents()
      Get all ItemStacks from the armor slots
      Returns:
      All the ItemStacks from the armor slots. Individual items can be null.
    • getExtraContents

      @NotNull GegenstandsStapel[] getExtraContents()
      Get all additional ItemStacks stored in this inventar.
      NB: What defines an extra slot is up to the implementation, however it will not be contained within Inventar.getStorageContents() or getArmorContents()
      Returns:
      All additional ItemStacks. Individual items can be null.
    • getHelmet

      @Nullable GegenstandsStapel getHelmet()
      Return the GegenstandsStapel from the helmet slot
      Returns:
      The GegenstandsStapel in the helmet slot
    • getChestplate

      @Nullable GegenstandsStapel getChestplate()
      Return the GegenstandsStapel from the chestplate slot
      Returns:
      The GegenstandsStapel in the chestplate slot
    • getLeggings

      @Nullable GegenstandsStapel getLeggings()
      Return the GegenstandsStapel from the leg slot
      Returns:
      The GegenstandsStapel in the leg slot
    • getBoots

      @Nullable GegenstandsStapel getBoots()
      Return the GegenstandsStapel from the boots slot
      Returns:
      The GegenstandsStapel in the boots slot
    • setItem

      void setItem(int index, @Nullable GegenstandsStapel item)
      Stores the GegenstandsStapel at the given index of the inventar.

      Indexes 0 through 8 refer to the hotbar. 9 through 35 refer to the main inventar, counting up from 9 at the top left corner of the inventar, moving to the right, and moving to the row below it back on the left side when it reaches the end of the row. It follows the same path in the inventar like you would read a book.

      Indexes 36 through 39 refer to the armor slots. Though you can set armor with this method using these indexes, you are encouraged to use the provided methods for those slots.

      Index 40 refers to the off hand (shield) item slot. Though you can set off hand with this method using this index, you are encouraged to use the provided method for this slot.

      If you attempt to use this method with an index less than 0 or greater than 40, an ArrayIndexOutOfBounds exception will be thrown.

      Specified by:
      setItem in interface Inventar
      Parameters:
      index - The index where to put the GegenstandsStapel
      item - The GegenstandsStapel to set
      Throws:
      ArrayIndexOutOfBoundsException - when index < 0 || index > 40
      See Also:
    • setItem

      void setItem(@NotNull AusstattungsSpalte slot, @Nullable GegenstandsStapel item)
      Stores the GegenstandsStapel at the given equipment slot in the inventar.
      Parameters:
      slot - the slot to put the GegenstandsStapel
      item - the GegenstandsStapel to set
      See Also:
    • getItem

      @Nullable GegenstandsStapel getItem(@NotNull AusstattungsSpalte slot)
      Gets the GegenstandsStapel at the given equipment slot in the inventar.
      Parameters:
      slot - the slot to get the GegenstandsStapel
      Returns:
      the GegenstandsStapel in the given slot or null if there is not one
    • setArmorContents

      void setArmorContents(@Nullable GegenstandsStapel[] items)
      Put the given ItemStacks into the armor slots
      Parameters:
      items - The ItemStacks to use as armour
    • setExtraContents

      void setExtraContents(@Nullable GegenstandsStapel[] items)
      Put the given ItemStacks into the extra slots
      See getExtraContents() for an explanation of extra slots.
      Parameters:
      items - The ItemStacks to use as extra
    • setHelmet

      void setHelmet(@Nullable GegenstandsStapel helmet)
      Put the given GegenstandsStapel into the helmet slot. This does not check if the GegenstandsStapel is a helmet
      Parameters:
      helmet - The GegenstandsStapel to use as helmet
    • setChestplate

      void setChestplate(@Nullable GegenstandsStapel chestplate)
      Put the given GegenstandsStapel into the chestplate slot. This does not check if the GegenstandsStapel is a chestplate
      Parameters:
      chestplate - The GegenstandsStapel to use as chestplate
    • setLeggings

      void setLeggings(@Nullable GegenstandsStapel leggings)
      Put the given GegenstandsStapel into the leg slot. This does not check if the GegenstandsStapel is a pair of leggings
      Parameters:
      leggings - The GegenstandsStapel to use as leggings
    • setBoots

      void setBoots(@Nullable GegenstandsStapel boots)
      Put the given GegenstandsStapel into the boots slot. This does not check if the GegenstandsStapel is a boots
      Parameters:
      boots - The GegenstandsStapel to use as boots
    • getItemInMainHand

      @NotNull GegenstandsStapel getItemInMainHand()
      Gets a copy of the item the spieler is currently holding in their main hand.
      Returns:
      the currently held item
    • setItemInMainHand

      void setItemInMainHand(@Nullable GegenstandsStapel item)
      Sets the item the spieler is holding in their main hand.
      Parameters:
      item - The item to put into the spieler's hand
    • getItemInOffHand

      @NotNull GegenstandsStapel getItemInOffHand()
      Gets a copy of the item the spieler is currently holding in their off hand.
      Returns:
      the currently held item
    • setItemInOffHand

      void setItemInOffHand(@Nullable GegenstandsStapel item)
      Sets the item the spieler is holding in their off hand.
      Parameters:
      item - The item to put into the spieler's hand
    • getItemInHand

      @Deprecated @NotNull GegenstandsStapel getItemInHand()
      Deprecated.
      players can duel wield now use the methods for the specific hand instead
      Gets a copy of the item the spieler is currently holding
      Returns:
      the currently held item
      See Also:
    • setItemInHand

      @Deprecated void setItemInHand(@Nullable GegenstandsStapel stack)
      Deprecated.
      players can duel wield now use the methods for the specific hand instead
      Sets the item the spieler is holding
      Parameters:
      stack - The item to put into the spieler's hand
      See Also:
    • getHeldItemSlot

      int getHeldItemSlot()
      Get the slot number of the currently held item
      Returns:
      Held item slot number
    • setHeldItemSlot

      void setHeldItemSlot(int slot)
      Set the slot number of the currently held item.

      This validates whether the slot is between 0 and 8 inclusive.

      Parameters:
      slot - The new slot number
      Throws:
      IllegalArgumentException - Thrown if slot is not between 0 and 8 inclusive
    • getHolder

      @Nullable MenschlichesWesen getHolder()
      Description copied from interface: Inventar
      Gets the block or wesen belonging to the open inventar
      Specified by:
      getHolder in interface Inventar
      Returns:
      The holder of the inventar; null if it has no holder.