Package me.croabeast.common.gui
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:
-
Field Summary
Fields inherited from class me.croabeast.common.gui.GuiBuilder
pane, value -
Method Summary
Modifier and TypeMethodDescription@NotNull ChestBuilderinstance()Returns this instance ofChestBuilderfor fluent chaining.static @NotNull ChestBuildervoidsetDisplayedPage(int rows, int index) Sets the displayed page for the chest GUI.voidshowGui(org.bukkit.entity.HumanEntity entity) Displays the chest GUI to the specified human entity.Methods inherited from class me.croabeast.common.gui.GuiBuilder
addPane, addSingleItem, getPanes, setDisplayedPage
-
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:
setDisplayedPagein classGuiBuilder<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:
showGuiin classGuiBuilder<com.github.stefvanschie.inventoryframework.gui.type.ChestGui,ChestBuilder> - Parameters:
entity- the human entity (typically a player) to show the GUI to
-
instance
Returns this instance ofChestBuilderfor fluent chaining.- Returns:
- this builder instance
-
of
-