Package xyz.xenondevs.invui.gui
Interface PagedGui<C>
- Type Parameters:
C- The content type
- All Superinterfaces:
Gui
- All Known Implementing Classes:
AbstractPagedGui
A
Gui that can display multiple pages of content.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPageChangeHandler(@NotNull BiConsumer<Integer, Integer> handler) Registers a page change handler.voidbake()Bakes and updates the pages of thisPagedGuibased on the current content.int[]Gets the slot indices that are used to display content in thisPagedGui.intGets the current page of thisPagedGuias an index.intGets the amount of pages thisPagedGuihas.@Nullable List<@NotNull BiConsumer<Integer, Integer>> Gets the registered page change handlers.voidgoBack()Displays the previous page if there is one.voidDisplays the next page if there is one.static @NotNull PagedGui.Builder<@NotNull Gui> guis()guis(@NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Gui>> consumer) booleanGets if there are infinite pages in thisPagedGui.booleanChecks if there is a next page.booleanChecks if there is a previous page.static @NotNull PagedGui.Builder<@NotNull Inventory> inventories(@NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Inventory>> consumer) static @NotNull PagedGui.Builder<@NotNull Item> items()items(@NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Item>> consumer) Creates a newPagedGui.Creates a newPagedGui.ofInventories(int width, int height, @NotNull List<@NotNull Inventory> inventories, int... contentListSlots) Creates a newPagedGui.ofInventories(@NotNull Structure structure, @NotNull List<@NotNull Inventory> inventories) Creates a newPagedGui.Creates a newPagedGui.Creates a newPagedGui.voidremovePageChangeHandler(@NotNull BiConsumer<Integer, Integer> handler) Unregisters a page change handler.voidsetContent(@Nullable List<@NotNull C> content) Sets the content of thisPagedGuifor all pages.voidsetPage(int page) Sets the current page of thisPagedGui.voidsetPageChangeHandlers(@Nullable List<@NotNull BiConsumer<Integer, Integer>> handlers) Replaces the currently registered page change handlers with the given list.Methods inherited from interface xyz.xenondevs.invui.gui.Gui
addItems, addSlotElements, applyStructure, cancelAnimation, closeForAllViewers, fill, fill, fillBorders, fillColumn, fillRectangle, fillRectangle, fillRectangle, fillRectangle, fillRow, findAllCurrentViewers, findAllWindows, getBackground, getHeight, getItem, getItem, getSize, getSlotElement, getSlotElement, getSlotElements, getWidth, hasSlotElement, hasSlotElement, isFrozen, isIgnoreObscuredInventorySlots, playAnimation, remove, remove, setBackground, setFrozen, setIgnoreObscuredInventorySlots, setItem, setItem, setSlotElement, setSlotElement
-
Method Details
-
items
- Returns:
- The new
Gui Builder.
-
items
@NotNull static @NotNull PagedGui<@NotNull Item> items(@NotNull @NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Item>> consumer) - Parameters:
consumer- TheConsumerto configure theGui 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 newPagedGui. -
ofItems
@NotNull static @NotNull PagedGui<@NotNull Item> ofItems(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Item> items) Creates a newPagedGui. -
guis
- Returns:
- The new
Gui Builder.
-
guis
@NotNull static @NotNull PagedGui<@NotNull Gui> guis(@NotNull @NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Gui>> consumer) - Parameters:
consumer- TheConsumerto configure theGui 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 newPagedGui. -
ofGuis
@NotNull static @NotNull PagedGui<@NotNull Gui> ofGuis(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Gui> guis) Creates a newPagedGui. -
inventories
- Returns:
- The new
Gui Builder.
-
inventories
@NotNull static @NotNull PagedGui<@NotNull Inventory> inventories(@NotNull @NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Inventory>> consumer) - Parameters:
consumer- TheConsumerto configure theGui 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 newPagedGui.- Parameters:
width- The width of thePagedGui.height- The height of thePagedGui.inventories- TheInventoriesto 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 newPagedGui.- Parameters:
structure- TheStructureto use.inventories- TheInventoriesto use as pages.- Returns:
- The created
PagedGui.
-
getPageAmount
int getPageAmount()Gets the amount of pages thisPagedGuihas.- Returns:
- The amount of pages this
PagedGuihas.
-
getCurrentPage
int getCurrentPage()Gets the current page of thisPagedGuias an index.- Returns:
- Gets the current page of this
PagedGuias an index.
-
setPage
void setPage(int page) Sets the current page of thisPagedGui.- 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 thisPagedGui.- 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 thisPagedGui.- Returns:
- The slot indices that are used to display content in this
PagedGui.
-
setContent
Sets the content of thisPagedGuifor all pages.- Parameters:
content- The content to set.
-
bake
void bake()Bakes and updates the pages of thisPagedGuibased 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
Gets the registered page change handlers.- Returns:
- The registered page change handlers.
-
setPageChangeHandlers
Replaces the currently registered page change handlers with the given list.- Parameters:
handlers- The new page change handlers.
-
addPageChangeHandler
Registers a page change handler.- Parameters:
handler- The handler to register.
-
removePageChangeHandler
Unregisters a page change handler.- Parameters:
handler- The handler to unregister.
-