Class SequencePaginatedMask

java.lang.Object
io.github.projectunified.craftux.mask.PaginatedMask
io.github.projectunified.craftux.mask.SequencePaginatedMask
All Implemented Interfaces:
Element, Mask

public abstract class SequencePaginatedMask extends PaginatedMask
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 Details

  • Constructor Details

    • SequencePaginatedMask

      protected SequencePaginatedMask(@NotNull @NotNull Function<UUID,List<Position>> maskPositionFunction)
      Create a new mask
      Parameters:
      maskPositionFunction - the mask position function
  • Method Details

    • getMaskPositionFunction

      @NotNull public @NotNull Function<UUID,List<Position>> getMaskPositionFunction()
      Get the mask position function
      Returns:
      the mask position
    • getButtons

      @NotNull public abstract @NotNull List<Button> getButtons(@NotNull @NotNull UUID uuid)
      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: PaginatedMask
      Generate the item map for the unique id
      Specified by:
      getItemMap in class PaginatedMask
      Parameters:
      uuid - the unique id
      pageNumber - the page number
      Returns:
      the map contains the positions and the buttons
    • stop

      public void stop()
      Clears the page number mappings for all users.