Class PagedMenuBuilder

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

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

    • PagedMenuBuilder

      protected PagedMenuBuilder(boolean mutable, String template)
  • Method Details

    • id

      public PagedMenuBuilder 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 PagedMenuBuilder title(net.kyori.adventure.text.Component title)
      Set the title of the menu.
      Parameters:
      title - The title
      Returns:
      The builder
    • title

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

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

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

      public PagedMenuBuilder onNextPage(MenuAction action)
      Add an action to run when the next page is opened.
      Parameters:
      action - The action
      Returns:
      The builder
    • onPreviousPage

      public PagedMenuBuilder onPreviousPage(MenuAction action)
      Add an action to run when the previous page is opened.
      Parameters:
      action - The action
      Returns:
      The builder
    • options

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

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

      public PagedMenuBuilder button(char character, Button button)
      Add a button mapping.
      Parameters:
      character - The character to map
      button - The button to map to
      Returns:
      The builder
    • buttons

      public PagedMenuBuilder buttons(List<Button> buttons)
      Set the buttons for the menu.
      Parameters:
      buttons - The buttons
      Returns:
      The builder
    • buttons

      public PagedMenuBuilder buttons(Button... buttons)
      Set the buttons for the menu.
      Parameters:
      buttons - The buttons
      Returns:
      The builder
    • shrinkToFit

      public PagedMenuBuilder shrinkToFit(boolean shrinkToFit)
      Set whether the menu should shrink to fit the buttons.
      Parameters:
      shrinkToFit - Whether the menu should shrink to fit the buttons
      Returns:
      The builder
    • marker

      public PagedMenuBuilder marker(char marker)
      Sets the marker character
      Parameters:
      marker - The character to use as a marker
      Returns:
      The builder
    • marker

      public PagedMenuBuilder marker(char marker, Button fallback)
      Sets the marker and the empty marker
      Parameters:
      marker - The character to use as a marker
      fallback - The button to use as a fallback in place of a marker if there are no more buttons to show, but there are still placeholders
      Returns:
      The builder
    • build

      public PagedMenu 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 PagedMenuBuilder clone()
      Overrides:
      clone in class Object