Class SimpleMenuBuilder

java.lang.Object
net.staticstudios.menus.menu.SimpleMenuBuilder
All Implemented Interfaces:
Cloneable, MenuBuilder

public class SimpleMenuBuilder extends Object implements Cloneable, MenuBuilder
  • Constructor Details

    • SimpleMenuBuilder

      protected SimpleMenuBuilder(boolean mutable)
  • Method Details

    • id

      public SimpleMenuBuilder id(String id)
      Set the ID of the menu. This is used to track history and for other internal purposes.
      Parameters:
      id - The ID
      Returns:
      The builder
    • title

      public SimpleMenuBuilder title(net.kyori.adventure.text.Component title)
      Set the title of the menu.
      Parameters:
      title - The title
      Returns:
      The builder
    • title

      public SimpleMenuBuilder title(String title)
      Set the title of the menu.
      Parameters:
      title - The title
      Returns:
      The builder
    • size

      public SimpleMenuBuilder size(int size)
      Set the size of the menu.
      Parameters:
      size - The size
      Returns:
      The builder
    • addButton

      public SimpleMenuBuilder addButton(Button button)
      Add a button to the menu.
      Parameters:
      button - The button
      Returns:
      The builder
    • setButton

      public SimpleMenuBuilder setButton(int index, Button button)
      Set a button at a specific index.
      Parameters:
      index - The index
      button - The button
      Returns:
      The builder
    • onOpen

      public SimpleMenuBuilder onOpen(MenuAction action)
      Add an action to run when the menu is opened.
      Parameters:
      action - The action
      Returns:
      The builder
    • onClose

      public SimpleMenuBuilder onClose(MenuAction action)
      Add an action to run when the menu is closed.
      Parameters:
      action - The action
      Returns:
      The builder
    • options

      public SimpleMenuBuilder options(Function<MenuOptions,MenuOptions> optionsEditor)
      Set the options for the menu.
      Parameters:
      optionsEditor - A function to edit the options
      Returns:
      The builder
    • defaultPlaceholder

      public SimpleMenuBuilder defaultPlaceholder(Button defaultPlaceholder)
      Set the default placeholder button.
      Parameters:
      defaultPlaceholder - The default placeholder button
      Returns:
      The builder
    • build

      public Menu build(MenuViewer viewer)
      Description copied from interface: MenuBuilder
      Build the menu
      Specified by:
      build in interface MenuBuilder
      Parameters:
      viewer - The viewer to build the menu for
      Returns:
      The menu
    • clone

      public SimpleMenuBuilder clone()
      Overrides:
      clone in class Object