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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPageChangeHandler
(@NotNull BiConsumer<Integer, Integer> handler) Registers a page change handler.void
bake()
Bakes and updates the pages of thisPagedGui
based on the current content.int[]
Gets the slot indices that are used to display content in thisPagedGui
.int
Gets the current page of thisPagedGui
as an index.int
Gets the amount of pages thisPagedGui
has.@Nullable List
<@NotNull BiConsumer<Integer, Integer>> Gets the registered page change handlers.void
goBack()
Displays the previous page if there is one.void
Displays the next page if there is one.static @NotNull PagedGui.Builder
<@NotNull Gui> guis()
guis
(@NotNull Consumer<@NotNull PagedGui.Builder<@NotNull Gui>> consumer) boolean
Gets if there are infinite pages in thisPagedGui
.boolean
Checks if there is a next page.boolean
Checks 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
.void
removePageChangeHandler
(@NotNull BiConsumer<Integer, Integer> handler) Unregisters a page change handler.void
setContent
(@Nullable List<@NotNull C> content) Sets the content of thisPagedGui
for all pages.void
setPage
(int page) Sets the current page of thisPagedGui
.void
setPageChangeHandlers
(@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
- TheConsumer
to 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
- TheConsumer
to 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
- TheConsumer
to 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
- TheInventories
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 newPagedGui
.- Parameters:
structure
- TheStructure
to use.inventories
- TheInventories
to use as pages.- Returns:
- The created
PagedGui
.
-
getPageAmount
int getPageAmount()Gets the amount of pages thisPagedGui
has.- Returns:
- The amount of pages this
PagedGui
has.
-
getCurrentPage
int getCurrentPage()Gets the current page of thisPagedGui
as an index.- Returns:
- Gets the current page of this
PagedGui
as 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 thisPagedGui
for all pages.- Parameters:
content
- The content to set.
-
bake
void bake()Bakes and updates the pages of thisPagedGui
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
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.
-