Class ButtonPaginatedMask

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

public abstract class ButtonPaginatedMask extends PaginatedMask
An abstract mask that displays a paginated list of buttons across multiple pages. Subclasses define the positions and button lists, while this class handles pagination logic.

Example usage:


 public class MyButtonPaginatedMask extends ButtonPaginatedMask {
     public MyButtonPaginatedMask() {
         super(uuid -> Arrays.asList(Position.of(0, 0), Position.of(1, 1)));
     }

     @Override
     public List<Button> getButtons(UUID uuid) {
         return Arrays.asList(
             new SimpleButton(new ItemStack(Material.WOODEN_SWORD)),
             new SimpleButton(new ItemStack(Material.STONE_SWORD))
         );
     }
 }
 
  • Constructor Details

    • ButtonPaginatedMask

      protected ButtonPaginatedMask(@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 function
    • 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.