Class GuiLayoutBuilder

java.lang.Object
github.nighter.smartspawner.api.gui.GuiLayoutBuilder

public class GuiLayoutBuilder extends Object
Builder for creating GuiLayoutData instances programmatically. Used in the SmartSpawner Developer API to define custom GUI layouts.

Example usage:

GuiLayoutData layout = new GuiLayoutBuilder()
    .type(GuiLayoutType.MAIN_GUI)
    .addButton(new GuiButtonBuilder().slot(11).material(Material.CHEST).action("click", "open_storage").build())
    .build();
  • Constructor Details

    • GuiLayoutBuilder

      public GuiLayoutBuilder()
  • Method Details

    • type

      public GuiLayoutBuilder type(GuiLayoutType type)
      Sets the layout type.
      Parameters:
      type - the GUI layout type
      Returns:
      this builder
    • addButton

      public GuiLayoutBuilder addButton(GuiButtonData button)
      Adds a button to this layout.
      Parameters:
      button - the button data
      Returns:
      this builder
    • addButton

      public GuiLayoutBuilder addButton(String key, GuiButtonData button)
      Adds a button with a specific key to this layout.
      Parameters:
      key - the button key (e.g., "slot_11")
      button - the button data
      Returns:
      this builder
    • build

      public GuiLayoutData build()
      Builds the GuiLayoutData instance.
      Returns:
      the immutable layout data