Class AbstractGui

java.lang.Object
com.github.darksoulq.abyssallib.world.gui.Gui
com.github.darksoulq.abyssallib.world.gui.AbstractGui

public abstract class AbstractGui extends Gui
An abstract base implementation of a Graphical User Interface (GUI). This class serves as a template for creating custom menus by providing lifecycle hooks and simplified methods for managing elements, flags, and layers.
  • Constructor Details

    • AbstractGui

      public AbstractGui(org.bukkit.inventory.MenuType menuType, net.kyori.adventure.text.Component title, int tickInterval)
      Constructs a new AbstractGui with the specified menu type and title. Initializes internal collections including a HashMap for elements and LinkedLists for layers and animations.
      Parameters:
      menuType - The MenuType defining the size and shape of the inventory.
      title - The Component representing the display name of the menu.
      tickInterval - The interval between each GuiView#render call
  • Method Details

    • set

      public void set(SlotPosition pos, GuiElement element)
      Assigns a GuiElement to a specific position within the GUI grid.
      Parameters:
      pos - The SlotPosition where the element should be placed.
      element - The GuiElement to be rendered at the specified position.
    • addFlag

      public void addFlag(GuiFlag flag)
      Enables a specific behavior or restriction flag for this GUI.
      Parameters:
      flag - The GuiFlag to be added to the GUI configuration.
    • addFlags

      public void addFlags(GuiFlag... flags)
      Enables multiple behavior or restriction flags for this GUI.
      Parameters:
      flags - A varargs array of GuiFlag constants to be added.
    • addLayer

      public void addLayer(GuiLayer layer)
      Adds a functional layer to the GUI. Layers are processed to determine element visibility and interaction priority.
      Parameters:
      layer - The GuiLayer to append to the GUI's layer stack.