Class PaginatedMask

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

public abstract class PaginatedMask extends BaseMask
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected final Map<UUID,Integer>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    PaginatedMask(@NotNull String name)
    Create a new mask
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<Map<@NotNull Integer,@NotNull Button>>
    generateButtons(@NotNull UUID uuid, @NotNull InventorySize inventorySize)
    Generate the buttons for the unique id
    protected abstract Optional<Map<@NotNull Integer,@NotNull Button>>
    generateButtons(@NotNull UUID uuid, @NotNull InventorySize inventorySize, int pageNumber)
    Generate the buttons for the unique id
    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
    protected int
    getExactPage(int page, int pageAmount)
    Get the exact page from the input page
    int
    getPage(@NotNull UUID uuid)
    Get the current page for the unique id
    boolean
    Check if this paginated mask allows cycle page (The first page after the last page)
    void
    nextPage(@NotNull UUID uuid)
    Set the next page for the unique id
    void
    previousPage(@NotNull UUID uuid)
    Set the previous page for the unique id
    void
    setCycle(boolean cycle)
    Set if this paginated mask allows cycle page (The first page after the last page)
    void
    setPage(@NotNull UUID uuid, int page)
    Set the page for the unique id

    Methods inherited from class me.hsgamer.hscore.minecraft.gui.mask.BaseMask

    getName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface me.hsgamer.hscore.ui.property.Initializable

    init, stop
  • 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