Class SequencePaginatedMask
java.lang.Object
io.github.projectunified.craftux.mask.PaginatedMask
io.github.projectunified.craftux.mask.SequencePaginatedMask
A paginated mask that displays a sequence of buttons across multiple pages.
Each page shows a consecutive subset of buttons from the list.
Example usage:
public class MySequenceMask extends SequencePaginatedMask {
public MySequenceMask() {
super(uuid -> Arrays.asList(Position.of(0, 0), Position.of(1, 0)));
}
@Override
public List<Button> getButtons(UUID uuid) {
return Arrays.asList(
new SimpleButton(new ItemStack(Material.RED_DYE)),
new SimpleButton(new ItemStack(Material.BLUE_DYE)),
new SimpleButton(new ItemStack(Material.GREEN_DYE)),
new SimpleButton(new ItemStack(Material.YELLOW_DYE))
);
}
}
// Page 0: red, blue; Page 1: blue, green; Page 2: green, yellow
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class io.github.projectunified.craftux.mask.PaginatedMask
cycle, pageNumberMap -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSequencePaginatedMask(@NotNull Function<UUID, List<Position>> maskPositionFunction) Create a new mask -
Method Summary
Modifier and TypeMethodDescriptiongetButtons(@NotNull UUID uuid) Get the buttons for the unique idprotected @Nullable Map<Position, Consumer<ActionItem>> getItemMap(@NotNull UUID uuid, int pageNumber) Generate the item map for the unique idGet the mask position functionvoidstop()Clears the page number mappings for all users.Methods inherited from class io.github.projectunified.craftux.mask.PaginatedMask
apply, getAndSetExactPage, getExactPage, getPage, isCycle, nextPage, previousPage, setCycle, setPageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.projectunified.craftux.common.Mask
getActionMap
-
Field Details
-
maskPositionFunction
-
-
Constructor Details
-
Method Details
-
getMaskPositionFunction
Get the mask position function- Returns:
- the mask position
-
getButtons
Get the buttons for the unique id- Parameters:
uuid- the unique id- Returns:
- the buttons
-
getItemMap
@Nullable protected @Nullable Map<Position,Consumer<ActionItem>> getItemMap(@NotNull @NotNull UUID uuid, int pageNumber) Description copied from class:PaginatedMaskGenerate the item map for the unique id- Specified by:
getItemMapin classPaginatedMask- Parameters:
uuid- the unique idpageNumber- the page number- Returns:
- the map contains the positions and the buttons
-
stop
public void stop()Clears the page number mappings for all users.
-