Class Menu

java.lang.Object
com.github.pinont.singularitylib.api.ui.Menu
Direct Known Subclasses:
PaginatedMenu

public class Menu extends Object
Class for creating and managing custom inventory menus. Provides functionality to create interactive GUIs with buttons and layouts.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Menu(org.bukkit.plugin.Plugin plugin, String title)
    Creates a new Menu with the specified title and automatic size.
    Menu(org.bukkit.plugin.Plugin plugin, String title, int size)
    Creates a new Menu with the specified title and size.
  • Method Summary

    Modifier and Type
    Method
    Description
    addButton(Button button)
    Adds a button to this menu.
    protected void
    Clears all buttons (used by subclasses that re-render per page).
    Gets the list of buttons in this menu.
    Gets the layout pattern of this menu.
    protected org.bukkit.plugin.Plugin
    Gets the owning plugin.
    int
    Gets the size of this menu.
    Gets the title of this menu.
    setKey(Layout... layouts)
    Sets the layout keys that map characters to buttons.
    setLayout(String... layout)
    Sets the layout pattern for this menu using string patterns.
    void
    show(org.bukkit.entity.Player player)
    Shows this menu to the specified player.

    Methods inherited from class Object

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

    • Menu

      public Menu(org.bukkit.plugin.Plugin plugin, String title)
      Creates a new Menu with the specified title and automatic size.
      Parameters:
      title - the title of the menu
    • Menu

      public Menu(org.bukkit.plugin.Plugin plugin, String title, int size)
      Creates a new Menu with the specified title and size.
      Parameters:
      title - the title of the menu
      size - the size of the menu inventory
  • Method Details

    • getButtons

      public ArrayList<Button> getButtons()
      Gets the list of buttons in this menu.
      Returns:
      the list of buttons
    • clearButtons

      protected void clearButtons()
      Clears all buttons (used by subclasses that re-render per page).
    • getPlugin

      protected org.bukkit.plugin.Plugin getPlugin()
      Gets the owning plugin.
      Returns:
      the plugin that owns this menu
    • getTitle

      public String getTitle()
      Gets the title of this menu.
      Returns:
      the menu title
    • getSize

      public int getSize()
      Gets the size of this menu.
      Returns:
      the menu size
    • setLayout

      public Menu setLayout(String... layout)
      Sets the layout pattern for this menu using string patterns.
      Parameters:
      layout - the layout strings defining the menu structure
      Returns:
      this Menu for method chaining
    • getLayout

      public ArrayList<String> getLayout()
      Gets the layout pattern of this menu.
      Returns:
      the layout pattern as a list of strings
    • setKey

      public Menu setKey(Layout... layouts)
      Sets the layout keys that map characters to buttons.
      Parameters:
      layouts - the layout mappings
      Returns:
      this Menu for method chaining
    • addButton

      public Menu addButton(Button button)
      Adds a button to this menu.
      Parameters:
      button - the button to add
      Returns:
      this Menu for method chaining
    • show

      public void show(org.bukkit.entity.Player player)
      Shows this menu to the specified player.
      Parameters:
      player - the player to show the menu to