Interface PagedGui<C>

Type Parameters:
C - The content type
All Superinterfaces:
Gui
All Known Implementing Classes:
AbstractPagedGui

public interface PagedGui<C> extends Gui
A Gui that can display multiple pages of content.
  • Method Details

    • items

      @NotNull static @NotNull PagedGui.Builder<@NotNull Item> items()
      Creates a new Gui Builder for a PagedGui that uses Items as content.
      Returns:
      The new Gui Builder.
    • items

      @NotNull static @NotNull PagedGui<@NotNull Item> items(@NotNull @NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Item>> consumer)
      Creates a new PagedGui after configuring a Gui Builder using the given Consumer.
      Parameters:
      consumer - The Consumer to configure the Gui Builder.
      Returns:
      The created PagedGui.
    • ofItems

      @NotNull static @NotNull PagedGui<@NotNull Item> ofItems(int width, int height, @NotNull @NotNull List<@NotNull Item> items, int... contentListSlots)
      Creates a new PagedGui.
      Parameters:
      width - The width of the PagedGui.
      height - The height of the PagedGui.
      items - The Items to use as in pages.
      contentListSlots - The slots where content should be displayed.
      Returns:
      The created PagedGui.
    • ofItems

      @NotNull static @NotNull PagedGui<@NotNull Item> ofItems(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Item> items)
      Creates a new PagedGui.
      Parameters:
      structure - The Structure to use.
      items - The Items to use as in pages.
      Returns:
      The created PagedGui.
    • guis

      @NotNull static @NotNull PagedGui.Builder<@NotNull Gui> guis()
      Creates a new Gui Builder for a PagedGui that uses Guis as content.
      Returns:
      The new Gui Builder.
    • guis

      @NotNull static @NotNull PagedGui<@NotNull Gui> guis(@NotNull @NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Gui>> consumer)
      Creates a new PagedGui after configuring a Gui Builder using the given Consumer.
      Parameters:
      consumer - The Consumer to configure the Gui Builder.
      Returns:
      The created PagedGui.
    • ofGuis

      @NotNull static @NotNull PagedGui<@NotNull Gui> ofGuis(int width, int height, @NotNull @NotNull List<@NotNull Gui> guis, int... contentListSlots)
      Creates a new PagedGui.
      Parameters:
      width - The width of the PagedGui.
      height - The height of the PagedGui.
      guis - The Guis to use as pages.
      contentListSlots - The slots where content should be displayed.
      Returns:
      The created PagedGui.
    • ofGuis

      @NotNull static @NotNull PagedGui<@NotNull Gui> ofGuis(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Gui> guis)
      Creates a new PagedGui.
      Parameters:
      structure - The Structure to use.
      guis - The Guis to use as pages.
      Returns:
      The created PagedGui.
    • inventories

      @NotNull static @NotNull PagedGui.Builder<@NotNull Inventory> inventories()
      Creates a new Gui Builder for a PagedGui that uses Inventories as content.
      Returns:
      The new Gui Builder.
    • inventories

      @NotNull static @NotNull PagedGui<@NotNull Inventory> inventories(@NotNull @NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Inventory>> consumer)
      Creates a new PagedGui after configuring a Gui Builder using the given Consumer.
      Parameters:
      consumer - The Consumer to configure the Gui Builder.
      Returns:
      The created PagedGui.
    • ofInventories

      @NotNull static @NotNull PagedGui<@NotNull Inventory> ofInventories(int width, int height, @NotNull @NotNull List<@NotNull Inventory> inventories, int... contentListSlots)
      Creates a new PagedGui.
      Parameters:
      width - The width of the PagedGui.
      height - The height of the PagedGui.
      inventories - The Inventories to use as pages.
      contentListSlots - The slots where content should be displayed.
      Returns:
      The created PagedGui.
    • ofInventories

      @NotNull static @NotNull PagedGui<@NotNull Inventory> ofInventories(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Inventory> inventories)
      Creates a new PagedGui.
      Parameters:
      structure - The Structure to use.
      inventories - The Inventories to use as pages.
      Returns:
      The created PagedGui.
    • getPageAmount

      int getPageAmount()
      Gets the amount of pages this PagedGui has.
      Returns:
      The amount of pages this PagedGui has.
    • getCurrentPage

      int getCurrentPage()
      Gets the current page of this PagedGui as an index.
      Returns:
      Gets the current page of this PagedGui as an index.
    • setPage

      void setPage(int page)
      Sets the current page of this PagedGui.
      Parameters:
      page - The page to set.
    • hasNextPage

      boolean hasNextPage()
      Checks if there is a next page.
      Returns:
      Whether there is a next page.
    • hasPreviousPage

      boolean hasPreviousPage()
      Checks if there is a previous page.
      Returns:
      Whether there is a previous page.
    • hasInfinitePages

      boolean hasInfinitePages()
      Gets if there are infinite pages in this PagedGui.
      Returns:
      Whether there are infinite pages in this PagedGui.
    • goForward

      void goForward()
      Displays the next page if there is one.
    • goBack

      void goBack()
      Displays the previous page if there is one.
    • getContentListSlots

      int[] getContentListSlots()
      Gets the slot indices that are used to display content in this PagedGui.
      Returns:
      The slot indices that are used to display content in this PagedGui.
    • setContent

      void setContent(@Nullable @Nullable List<@NotNull C> content)
      Sets the content of this PagedGui for all pages.
      Parameters:
      content - The content to set.
    • bake

      void bake()
      Bakes and updates the pages of this PagedGui based on the current content.

      This method does not need to be called when using setContent(List), but is required when the size of the content itself changes.

    • getPageChangeHandlers

      @Nullable @Nullable List<@NotNull BiConsumer<Integer,Integer>> getPageChangeHandlers()
      Gets the registered page change handlers.
      Returns:
      The registered page change handlers.
    • setPageChangeHandlers

      void setPageChangeHandlers(@Nullable @Nullable List<@NotNull BiConsumer<Integer,Integer>> handlers)
      Replaces the currently registered page change handlers with the given list.
      Parameters:
      handlers - The new page change handlers.
    • addPageChangeHandler

      void addPageChangeHandler(@NotNull @NotNull BiConsumer<Integer,Integer> handler)
      Registers a page change handler.
      Parameters:
      handler - The handler to register.
    • removePageChangeHandler

      void removePageChangeHandler(@NotNull @NotNull BiConsumer<Integer,Integer> handler)
      Unregisters a page change handler.
      Parameters:
      handler - The handler to unregister.