Class PaginationMenu.Builder

java.lang.Object
me.tayebyassine.homestead.gui.PaginationMenu.Builder
Enclosing class:
PaginationMenu

public static final class PaginationMenu.Builder extends Object
  • Method Details

    • nextPageItem

      public PaginationMenu.Builder nextPageItem(org.bukkit.inventory.ItemStack item)
      Sets the item displayed for the next-page button.
      Parameters:
      item - the next-page item
      Returns:
      this builder
    • prevPageItem

      public PaginationMenu.Builder prevPageItem(org.bukkit.inventory.ItemStack item)
      Sets the item displayed for the previous-page button.
      Parameters:
      item - the previous-page item
      Returns:
      this builder
    • items

      public PaginationMenu.Builder items(List<org.bukkit.inventory.ItemStack> items)
      Sets the items to display across all pages.
      Parameters:
      items - the content items
      Returns:
      this builder
    • goBack

      public PaginationMenu.Builder goBack(BiConsumer<org.bukkit.entity.Player, org.bukkit.event.inventory.InventoryClickEvent> callback)
      Sets the callback invoked when the go-back button (slot 0) is clicked.
      Parameters:
      callback - the go-back callback
      Returns:
      this builder
    • onClick

      public PaginationMenu.Builder onClick(BiConsumer<org.bukkit.entity.Player, PaginationMenu.ClickContext> callback)
      Sets the callback invoked when a content item is clicked.
      Parameters:
      callback - the click callback
      Returns:
      this builder
    • itemsPerPage

      public PaginationMenu.Builder itemsPerPage(int n)
      Sets the number of items displayed per page.
      Parameters:
      n - items per page (defaults to content area size)
      Returns:
      this builder
    • onOpen

      public PaginationMenu.Builder onOpen(Consumer<org.bukkit.inventory.Inventory> handler)
      Sets a handler invoked after the inventory is created, before it is shown.
      Parameters:
      handler - the open handler
      Returns:
      this builder
    • fillEmptySlots

      public PaginationMenu.Builder fillEmptySlots(org.bukkit.inventory.ItemStack filler)
      Fills empty header and footer slots with the given filler item.
      Parameters:
      filler - the filler item
      Returns:
      this builder
    • fillEmptySlots

      public PaginationMenu.Builder fillEmptySlots()
      Fills empty header and footer slots with the default empty-slot item.
      Returns:
      this builder
    • actionButton

      public PaginationMenu.Builder actionButton(int index, org.bukkit.inventory.ItemStack item, BiConsumer<org.bukkit.entity.Player, org.bukkit.event.inventory.InventoryClickEvent> callback)
      Adds an action button to the bottom row of the menu.
      Parameters:
      index - the button index (0, 1, or 2)
      item - the item to display
      callback - the click callback (may be null)
      Returns:
      this builder
    • build

      public PaginationMenu build()
      Builds the PaginationMenu. Next-page and previous-page items must be set.
      Returns:
      the built PaginationMenu
      Throws:
      IllegalStateException - if next-page or previous-page items are not set