Interface Backpack

All Superinterfaces:
DataSerializable

public interface Backpack extends DataSerializable
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addItem(int slot, ItemStack item)
    Add an item to the backpack.
    boolean
    addItem(int slot, ItemStackSnapshot item)
    Add an item to the backpack.
    asMenu(org.spongepowered.plugin.PluginContainer container, ServerPlayer openForTarget, int rows, Component title)
    Getting the contents of the backpack in the menu with the specified number of lines.
    All changes made will be automatically saved if the backpack data refers to the player's data in the CommandPack plugin.
    The menu is cleared after closing.
    Clearing when closed does not affect the backpack data.
     
    getItem(int slot)
    Getting an item from a backpack.
    Get a copy of all the items in the backpack.
    Get the numbers of the slots that contain the items.
    void
    removeItem(int slot)
    Remove an item from the backpack.
    void
    Save Backpack data.
    int
    The number of slots in the backpack that have items in them.

    Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable

    contentVersion, toContainer
  • Method Details

    • builder

      static Backpack.Builder builder()
    • addItem

      boolean addItem(int slot, ItemStack item)
      Add an item to the backpack.
    • addItem

      boolean addItem(int slot, ItemStackSnapshot item)
      Add an item to the backpack.
    • removeItem

      void removeItem(int slot)
      Remove an item from the backpack.
    • size

      int size()
      The number of slots in the backpack that have items in them.
    • getSlots

      Collection<Integer> getSlots()
      Get the numbers of the slots that contain the items.
    • getItems

      Collection<ItemStack> getItems()
      Get a copy of all the items in the backpack.
    • getItem

      Optional<ItemStack> getItem(int slot)
      Getting an item from a backpack.
    • asMenu

      InventoryMenu asMenu(org.spongepowered.plugin.PluginContainer container, ServerPlayer openForTarget, int rows, Component title)
      Getting the contents of the backpack in the menu with the specified number of lines.
      All changes made will be automatically saved if the backpack data refers to the player's data in the CommandPack plugin.
      The menu is cleared after closing.
      Clearing when closed does not affect the backpack data.
    • save

      void save()
      Save Backpack data.