Class Gui

java.lang.Object
com.github.darksoulq.abyssallib.world.gui.Gui
Direct Known Subclasses:
AbstractGui

public class Gui extends Object
Represents a template for a custom Graphical User Interface.

A Gui instance stores the menu configuration, including its type, title, static elements, visual layers, and event handlers. It is intended to be constructed via its Gui.Builder.

  • Constructor Details

    • Gui

      public Gui(org.bukkit.inventory.MenuType menuType, net.kyori.adventure.text.Component title, Map<SlotPosition, GuiElement> elements, List<GuiLayer> layers, List<Consumer<GuiView>> tickers, EnumSet<GuiFlag> flags, int tickInterval, Consumer<GuiView> onOpen, Consumer<GuiView> onClose)
      Constructs a new Gui configuration.
      Parameters:
      menuType - the type of inventory
      title - the inventory title
      elements - the static element map
      layers - the list of rendering layers
      tickers - the list of tick handlers
      flags - the behavior flags
      onOpen - the open handler
      onClose - the close handler
  • Method Details

    • getMenuType

      public org.bukkit.inventory.MenuType getMenuType()
      Gets the MenuType of this GUI.
      Returns:
      the menu type
    • getOnClose

      public Consumer<GuiView> getOnClose()
      Gets the closure event handler.
      Returns:
      the close consumer
    • getOnOpen

      public Consumer<GuiView> getOnOpen()
      Gets the opening event handler.
      Returns:
      the open consumer
    • getTickers

      public List<Consumer<GuiView>> getTickers()
      Gets the list of per-tick update handlers.
      Returns:
      the list of tickers
    • getLayers

      public List<GuiLayer> getLayers()
      Gets the list of visual layers.
      Returns:
      the list of layers
    • getElements

      public Map<SlotPosition, GuiElement> getElements()
      Gets the map of slot positions to GUI elements.
      Returns:
      the element map
    • hasFlag

      public boolean hasFlag(GuiFlag flag)
      Checks if a specific behavior flag is set.
      Parameters:
      flag - the flag to check
      Returns:
      true if the flag is present
    • getFlags

      public EnumSet<GuiFlag> getFlags()
      Gets all behavior flags associated with this GUI.
      Returns:
      the enum set of flags
    • getTickInterval

      public int getTickInterval()
      Gets the interval between each GuiView#render call.
      Returns:
      The interval between render calls
    • getTitle

      public net.kyori.adventure.text.Component getTitle()
      Gets the title component of this GUI.
      Returns:
      the title
    • builder

      public static Gui.Builder builder(org.bukkit.inventory.MenuType type, net.kyori.adventure.text.Component title)
      Creates a new builder for a Gui.
      Parameters:
      type - the menu type
      title - the menu title
      Returns:
      a new builder instance