Class ChestBuilder

java.lang.Object
me.croabeast.common.gui.GuiBuilder<com.github.stefvanschie.inventoryframework.gui.type.ChestGui,ChestBuilder>
me.croabeast.common.gui.ChestBuilder
All Implemented Interfaces:
BaseBuilder<ChestBuilder>, Builder<com.github.stefvanschie.inventoryframework.gui.type.ChestGui,ChestBuilder>

public final class ChestBuilder extends GuiBuilder<com.github.stefvanschie.inventoryframework.gui.type.ChestGui,ChestBuilder>
A builder for creating and managing a chest GUI with paginated panes.

The ChestBuilder provides a fluent API to configure a chest GUI by setting the number of rows, the display name, and the currently visible page. It extends GuiBuilder and uses a PaginatedPane to manage multiple pages of content. The builder also supports showing the GUI to a human entity.

Example usage:


 ChestBuilder chest = new ChestBuilder(4, "invalid input: '&aMy' Chest GUI");
 chest.setDisplayedPage(2)
      .showGui(player);
 

See Also:
  • Method Details

    • setDisplayedPage

      public void setDisplayedPage(int rows, int index)
      Sets the displayed page for the chest GUI.

      If a valid row count is provided (greater than 0), the pane's height and the GUI's row count are updated accordingly. Then, the specified page is set and the GUI is refreshed.

      Specified by:
      setDisplayedPage in class GuiBuilder<com.github.stefvanschie.inventoryframework.gui.type.ChestGui,ChestBuilder>
      Parameters:
      rows - the number of rows to display (or -1 to use the default)
      index - the index of the page to display
    • showGui

      public void showGui(org.bukkit.entity.HumanEntity entity)
      Displays the chest GUI to the specified human entity.

      The GUI is added only once. On first display, the builder adds the paginated pane to the GUI, and subsequent calls simply show the GUI.

      Specified by:
      showGui in class GuiBuilder<com.github.stefvanschie.inventoryframework.gui.type.ChestGui,ChestBuilder>
      Parameters:
      entity - the human entity (typically a player) to show the GUI to
    • instance

      @NotNull public @NotNull ChestBuilder instance()
      Returns this instance of ChestBuilder for fluent chaining.
      Returns:
      this builder instance
    • of

      @NotNull public static @NotNull ChestBuilder of(int rows, String name)