Class PagedMenu

java.lang.Object
dev.demeng.pluginbase.menu.layout.PagedMenu
All Implemented Interfaces:
IMenu

public abstract class PagedMenu extends Object implements IMenu
A paginated GUI menu that will be displayed to a player.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Settings for the paged menu.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    PagedMenu(int pageSize, @NotNull String title, PagedMenu.Settings settings)
    Creates a new paged menu with the specified size per page and inventory title.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addButton(int slot, @NotNull org.bukkit.inventory.ItemStack stack, @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> actions)
    Creates and adds a static item that will be displayed on all pages.
    protected void
    Adds a static item that will be displayed on all pages.
    void
    fill(List<MenuButton> buttons)
    Fills the pages with the list of buttons.
    @NotNull List<Menu>
     
    void
    open(int index, org.bukkit.entity.Player... players)
    Opens a specific page of the menu to the players.
    void
    open(org.bukkit.entity.Player... players)
    Opens the menu for the provided player(s).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface dev.demeng.pluginbase.menu.IMenu

    onClose
  • Constructor Details

    • PagedMenu

      protected PagedMenu(int pageSize, @NotNull @NotNull String title, PagedMenu.Settings settings)
      Creates a new paged menu with the specified size per page and inventory title.
      Parameters:
      pageSize - The size of each page, in slots; must be greater than or equal to 9 and less than or equal to 54, and a multiple of 9
      title - The menu title, colorized internally and permits page number placeholders
      settings - The settings for the paged menu
  • Method Details

    • getPages

      @NotNull public @NotNull List<Menu> getPages()
    • fill

      public void fill(List<MenuButton> buttons)
      Fills the pages with the list of buttons.
      Parameters:
      buttons - The buttons that the menu should be filled with
    • addStaticButton

      protected void addStaticButton(MenuButton button)
      Adds a static item that will be displayed on all pages. Must be done AFTER the fill(List) method.
      Parameters:
      button - The button to set on all pages
    • addButton

      public void addButton(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack stack, @Nullable @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> actions)
      Creates and adds a static item that will be displayed on all pages. Must be done AFTER the fill(List) method.
      Parameters:
      slot - The slot of the button
      stack - The stack of the button
      actions - The actions of the button
    • open

      public void open(org.bukkit.entity.Player... players)
      Description copied from interface: IMenu
      Opens the menu for the provided player(s).
      Specified by:
      open in interface IMenu
      Parameters:
      players - The players the menu should be opened to
    • open

      public void open(int index, org.bukkit.entity.Player... players)
      Opens a specific page of the menu to the players.
      Parameters:
      index - The index of the page (starts at 0)
      players - THe players to open the page to