Class PaginatedMask
java.lang.Object
io.github.projectunified.craftux.mask.PaginatedMask
- Direct Known Subclasses:
ButtonPaginatedMask
,MaskPaginatedMask
,SequencePaginatedMask
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Map
<Position, Consumer<ActionItem>> Get a map of positions to action item consumersprotected int
getAndSetExactPage
(UUID uuid, int page, int pageAmount) Get the exact page from the input page and set it if it's not the sameprotected int
getExactPage
(int page, int pageAmount) Get the exact page from the input pageprotected abstract @Nullable Map
<Position, Consumer<ActionItem>> getItemMap
(@NotNull UUID uuid, int pageNumber) Generate the item map for the unique idint
Get the current page for the unique idboolean
isCycle()
Check if this paginated mask allows cycle page (The first page after the last page)void
Set the next page for the unique idvoid
previousPage
(@NotNull UUID uuid) Set the previous page for the unique idvoid
setCycle
(boolean cycle) Set if this paginated mask allows cycle page (The first page after the last page)void
Set the page for the unique id
-
Field Details
-
pageNumberMap
-
cycle
protected boolean cycle
-
-
Constructor Details
-
PaginatedMask
public PaginatedMask()
-
-
Method Details
-
getItemMap
@Nullable protected abstract @Nullable Map<Position,Consumer<ActionItem>> getItemMap(@NotNull @NotNull UUID uuid, int pageNumber) Generate the item map for the unique id- Parameters:
uuid
- the unique idpageNumber
- the page number- Returns:
- the map contains the positions and the buttons
-
getExactPage
protected int getExactPage(int page, int pageAmount) Get the exact page from the input page- Parameters:
page
- the input pagepageAmount
- the amount of pages- Returns:
- the exact page
-
getAndSetExactPage
Get the exact page from the input page and set it if it's not the same- Parameters:
uuid
- the unique idpage
- the input pagepageAmount
- the amount of pages- Returns:
- the exact page
-
setPage
Set the page for the unique id- Parameters:
uuid
- the unique idpage
- the page
-
getPage
Get the current page for the unique id- Parameters:
uuid
- the unique id- Returns:
- the page number
-
nextPage
Set the next page for the unique id- Parameters:
uuid
- the unique id
-
previousPage
Set the previous page for the unique id- Parameters:
uuid
- the unique id
-
isCycle
public boolean isCycle()Check if this paginated mask allows cycle page (The first page after the last page)- Returns:
- true if it does
-
setCycle
public void setCycle(boolean cycle) Set if this paginated mask allows cycle page (The first page after the last page)- Parameters:
cycle
- true if it does
-
apply
Description copied from interface:Mask
Get a map of positions to action item consumers
-