Class PaginatedMask
java.lang.Object
me.hsgamer.hscore.minecraft.gui.mask.PaginatedMask
- All Implemented Interfaces:
Function<@NotNull InventoryContext,,@Nullable Map<Integer, ActionItem>> GUIElement
- Direct Known Subclasses:
ButtonPaginatedMask,MaskPaginatedMask,SequencePaginatedMask
public abstract class PaginatedMask
extends Object
implements GUIElement, Function<@NotNull InventoryContext,@Nullable Map<Integer,ActionItem>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Map<Integer, ActionItem> apply(@NotNull InventoryContext context) protected intgetAndSetExactPage(UUID uuid, int page, int pageAmount) Get the exact page from the input page and set it if it's not the sameprotected intgetExactPage(int page, int pageAmount) Get the exact page from the input pageprotected abstract @Nullable Map<@NotNull Integer, @NotNull ActionItem> getItemMap(@NotNull InventoryContext context, int pageNumber) Generate the item map for the unique idintGet the current page for the unique idbooleanisCycle()Check if this paginated mask allows cycle page (The first page after the last page)voidSet the next page for the unique idvoidpreviousPage(@NotNull UUID uuid) Set the previous page for the unique idvoidsetCycle(boolean cycle) Set if this paginated mask allows cycle page (The first page after the last page)voidSet the page for the unique idMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.hsgamer.hscore.minecraft.gui.common.GUIElement
init, stop
-
Field Details
-
pageNumberMap
-
cycle
protected boolean cycle
-
-
Constructor Details
-
PaginatedMask
public PaginatedMask()
-
-
Method Details
-
getItemMap
@Nullable protected abstract @Nullable Map<@NotNull Integer,@NotNull ActionItem> getItemMap(@NotNull @NotNull InventoryContext context, int pageNumber) Generate the item map for the unique id- Parameters:
context- the contextpageNumber- the page number- Returns:
- the map contains the slots 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
@Nullable public @Nullable Map<Integer,ActionItem> apply(@NotNull @NotNull InventoryContext context) - Specified by:
applyin interfaceFunction<@NotNull InventoryContext,@Nullable Map<Integer, ActionItem>>
-