Class MenuHolder

java.lang.Object
com.kamikazejam.kamicommon.menu.api.MenuHolder
All Implemented Interfaces:
InventoryHolder
Direct Known Subclasses:
AbstractMenu

public class MenuHolder extends Object implements InventoryHolder
InventoryHolder with constructor parameters for making an Inventory with either a row count or an InventoryType.
Also contains a few utility methods for better utilization with the KamiCommon library.
  • Field Details

    • inventory

      @Nullable protected transient @Nullable Inventory inventory
    • title

      @NotNull protected @NotNull VersionedComponent title
    • size

      @NotNull protected @NotNull MenuSize size
  • Constructor Details

    • MenuHolder

      @Deprecated public MenuHolder(@NotNull @NotNull MenuSize size, @Nullable @Nullable String name)
      Deprecated.
      Replace with MenuHolder(MenuSize, VersionedComponent) and use a VersionedComponent instead.
      Constructs a new MenuHolder with the given size and legacy title string (containing color codes using the sections symbol).
      Any ampersand color codes will be converted to sections symbols automatically.
      Parameters:
      size - the size of the menu.
      name - the legacy title of the menu. If null, a single space will be used instead to prevent issues with Bukkit.
    • MenuHolder

      public MenuHolder(@NotNull @NotNull MenuSize size, @Nullable @Nullable VersionedComponent name)
      Constructs a new MenuHolder with the given size and title.
      Parameters:
      size - the size of the menu.
      name - the title of the menu. If null, a single space will be used instead to prevent issues with Bukkit.
  • Method Details

    • getInventory

      @NotNull public @NotNull Inventory getInventory()
      Specified by:
      getInventory in interface InventoryHolder
    • deleteInventory

      public void deleteInventory()
    • getRawInventory

      @Nullable public @Nullable Inventory getRawInventory()
    • closeAll

      public void closeAll(@NotNull @NotNull Set<UUID> exceptions)
    • getViewers

      @NotNull public @NotNull List<HumanEntity> getViewers()
    • getHolder

      @NotNull public @NotNull InventoryHolder getHolder()
    • getSize

      public int getSize()
    • getMenuSize

      @NotNull public @NotNull MenuSize getMenuSize()
    • getItem

      @Nullable public @Nullable ItemStack getItem(int slot)
    • setItem

      public void setItem(int slot, @Nullable @Nullable ItemStack item)
    • setItem

      public void setItem(int slot, @Nullable @Nullable ItemBuilder builder)
    • clear

      public void clear()
    • firstEmpty

      public int firstEmpty()
    • firstEmpty

      public int firstEmpty(@NotNull @NotNull Collection<Integer> slots)
    • firstEmpty

      public int firstEmpty(int[] slots)
    • replaceTitle

      public void replaceTitle(@NotNull @NotNull String find, @NotNull @NotNull String replacement)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object