Interface Gui


public interface Gui
Represents an interactive user interface inventory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addLayer(@NotNull GuiLayer layer)
    Adds a layout layer to the GUI.
    @NotNull ClosePolicy
    Gets the configured close policy for this GUI.
    Gets all layers registered in this GUI, ordered by priority.
    Consumer<org.bukkit.entity.Player>
    Gets the configured callback executed when the GUI is closed.
    int
    Gets the number of rows in the GUI.
    @NotNull String
    Gets the title of the GUI.
    void
    open(@NotNull org.bukkit.entity.Player player)
    Opens this GUI for the specified player.
    void
    removeLayer(@NotNull String layerId)
    Removes a layer from the GUI by its unique ID.
    void
    setClosePolicy(@NotNull ClosePolicy closePolicy)
    Sets the close policy for this GUI.
    void
    update(@NotNull org.bukkit.entity.Player player)
    Re-renders the GUI for the player by re-evaluating conditions and layers.
    void
    updateTitle(@NotNull org.bukkit.entity.Player player, @NotNull String title)
    Updates the title of the GUI for the player if they have it open.
  • Method Details

    • getTitle

      @NotNull @NotNull String getTitle()
      Gets the title of the GUI.
      Returns:
      the title
    • getRows

      int getRows()
      Gets the number of rows in the GUI.
      Returns:
      the number of rows (1 to 6)
    • addLayer

      void addLayer(@NotNull @NotNull GuiLayer layer)
      Adds a layout layer to the GUI.
      Parameters:
      layer - the layer to add
    • removeLayer

      void removeLayer(@NotNull @NotNull String layerId)
      Removes a layer from the GUI by its unique ID.
      Parameters:
      layerId - the ID of the layer to remove
    • getLayers

      @NotNull @NotNull Collection<GuiLayer> getLayers()
      Gets all layers registered in this GUI, ordered by priority.
      Returns:
      a collection of layers
    • open

      void open(@NotNull @NotNull org.bukkit.entity.Player player)
      Opens this GUI for the specified player.
      Parameters:
      player - the player to open the GUI for
    • update

      void update(@NotNull @NotNull org.bukkit.entity.Player player)
      Re-renders the GUI for the player by re-evaluating conditions and layers.
      Parameters:
      player - the player to update the GUI for
    • updateTitle

      void updateTitle(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String title)
      Updates the title of the GUI for the player if they have it open.
      Parameters:
      player - the player to update the title for
      title - the new title
    • getClosePolicy

      @NotNull @NotNull ClosePolicy getClosePolicy()
      Gets the configured close policy for this GUI.
      Returns:
      the close policy
    • setClosePolicy

      void setClosePolicy(@NotNull @NotNull ClosePolicy closePolicy)
      Sets the close policy for this GUI.
      Parameters:
      closePolicy - the close policy
    • getOnClose

      @Nullable Consumer<org.bukkit.entity.Player> getOnClose()
      Gets the configured callback executed when the GUI is closed.
      Returns:
      the close callback, or null if none is configured