Class PaginatedMask

java.lang.Object
me.hsgamer.hscore.minecraft.gui.mask.BaseMask
me.hsgamer.hscore.minecraft.gui.mask.impl.PaginatedMask
All Implemented Interfaces:
Mask, Initializable
Direct Known Subclasses:
ButtonPaginatedMask, MaskPaginatedMask, SequencePaginatedMask

public abstract class PaginatedMask extends BaseMask
  • Field Details

    • pageNumberMap

      protected final Map<UUID,Integer> pageNumberMap
    • cycle

      protected boolean cycle
  • Constructor Details

    • PaginatedMask

      protected PaginatedMask(@NotNull @NotNull String name)
      Create a new mask
      Parameters:
      name - the name of the mask
  • Method Details

    • generateButtons

      protected abstract Optional<Map<@NotNull Integer,@NotNull Button>> generateButtons(@NotNull @NotNull UUID uuid, @NotNull @NotNull InventorySize inventorySize, int pageNumber)
      Generate the buttons for the unique id
      Parameters:
      uuid - the unique id
      inventorySize - the size of the inventory
      pageNumber - the page number
      Returns:
      the map contains the slots and the buttons
      See Also:
    • getExactPage

      protected int getExactPage(int page, int pageAmount)
      Get the exact page from the input page
      Parameters:
      page - the input page
      pageAmount - the amount of pages
      Returns:
      the exact page
    • getAndSetExactPage

      protected int getAndSetExactPage(UUID uuid, int page, int pageAmount)
      Get the exact page from the input page and set it if it's not the same
      Parameters:
      uuid - the unique id
      page - the input page
      pageAmount - the amount of pages
      Returns:
      the exact page
    • setPage

      public void setPage(@NotNull @NotNull UUID uuid, int page)
      Set the page for the unique id
      Parameters:
      uuid - the unique id
      page - the page
    • getPage

      public int getPage(@NotNull @NotNull UUID uuid)
      Get the current page for the unique id
      Parameters:
      uuid - the unique id
      Returns:
      the page number
    • nextPage

      public void nextPage(@NotNull @NotNull UUID uuid)
      Set the next page for the unique id
      Parameters:
      uuid - the unique id
    • previousPage

      public void previousPage(@NotNull @NotNull UUID uuid)
      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
    • generateButtons

      public Optional<Map<@NotNull Integer,@NotNull Button>> generateButtons(@NotNull @NotNull UUID uuid, @NotNull @NotNull InventorySize inventorySize)
      Description copied from interface: Mask
      Generate the buttons for the unique id
      Parameters:
      uuid - the unique id
      inventorySize - the size of the inventory
      Returns:
      the map contains the slots and the buttons