Class AbstractMenu

java.lang.Object
me.totalfreedom.display.AbstractMenu

public abstract class AbstractMenu extends Object
Represents a menu that can be opened by a player.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractMenu(int size)
    Creates a new menu with the specified size.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    close(@NotNull org.bukkit.entity.Player player)
    Closes this menu for the specified player.
    void
    Deletes this menu.
     
     
     
     
    static Map<UUID,UUID>
     
    org.bukkit.inventory.ItemStack
    newItem(@NotNull org.bukkit.Material material, @NotNull net.kyori.adventure.text.Component name)
    Creates a new item with the specified material and name.
    org.bukkit.inventory.ItemStack
    newItem(@NotNull org.bukkit.Material material, @NotNull net.kyori.adventure.text.Component name, @NotNull net.kyori.adventure.text.Component... lore)
    Creates a new item with the specified material, name, and lore.
    void
    open(@NotNull org.bukkit.entity.Player player)
    Opens this menu for the specified player.
    void
    setItem(int slot, @NotNull org.bukkit.inventory.ItemStack stack)
    Sets the item at the specified slot.
    void
    setItem(int slot, @NotNull org.bukkit.inventory.ItemStack stack, @Nullable ClickAction action)
    Sets the item at the specified slot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractMenu

      protected AbstractMenu(int size)
      Creates a new menu with the specified size.
      Parameters:
      size - The size of the menu.
  • Method Details

    • getInvByUUID

      public static Map<UUID,AbstractMenu> getInvByUUID()
      Returns:
      A map of all menus by their UUID.
    • getOpenInvs

      public static Map<UUID,UUID> getOpenInvs()
      Returns:
      A map of all open menus by the player's UUID.
    • getDisplayableUUID

      public UUID getDisplayableUUID()
      Returns:
      The displayable UUID of this menu.
    • setItem

      public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack stack)
      Sets the item at the specified slot.
      Parameters:
      slot - The slot to set the item at.
      stack - The item to set.
    • setItem

      public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack stack, @Nullable @Nullable ClickAction action)
      Sets the item at the specified slot.
      Parameters:
      slot - The slot to set the item at.
      stack - The item to set.
      action - The action to perform when the item is clicked.
    • getDisplayable

      public Displayable getDisplayable()
      Returns:
      The displayable that represents this menu.
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player)
      Opens this menu for the specified player.
      Parameters:
      player - The player to open the menu for.
    • delete

      public void delete()
      Deletes this menu.
    • close

      public void close(@NotNull @NotNull org.bukkit.entity.Player player)
      Closes this menu for the specified player.
      Parameters:
      player - The player to close the menu for.
    • getActions

      public Map<Integer,ClickAction> getActions()
      Returns:
      A map of all actions by their slot.
    • newItem

      public org.bukkit.inventory.ItemStack newItem(@NotNull @NotNull org.bukkit.Material material, @NotNull @NotNull net.kyori.adventure.text.Component name)
      Creates a new item with the specified material and name.
      Parameters:
      material - The material of the item.
      name - The name of the item.
      Returns:
      The created item.
    • newItem

      public org.bukkit.inventory.ItemStack newItem(@NotNull @NotNull org.bukkit.Material material, @NotNull @NotNull net.kyori.adventure.text.Component name, @NotNull @NotNull net.kyori.adventure.text.Component... lore)
      Creates a new item with the specified material, name, and lore.
      Parameters:
      material - The material of the item.
      name - The name of the item.
      lore - The lore of the item.
      Returns:
      The created item.