Class Paginator

java.lang.Object
com.github.ygimenez.model.Paginator

public class Paginator extends Object
This is the core object for Pagination-Utils' settings.

All settings changed during Paginator creation will reflect across the whole library, allowing further customization of it.

This class must only be instantiated by PaginatorBuilder.
  • Constructor Details

    • Paginator

      protected Paginator()
      You shouldn't create a Paginator instance directly, please use PaginatorBuilder.
    • Paginator

      public Paginator(Object handler)
      You shouldn't create a Paginator instance directly, please use PaginatorBuilder.
      Parameters:
      handler - The handler that'll be used for event processing (must be either JDA or ShardManager).
  • Method Details

    • getHandler

      public Object getHandler()
      Retrieves the handler used during this Paginator's construction.
      Returns:
      The handler object (will be either JDA or ShardManager).
    • setHandler

      protected void setHandler(Object handler)
      Set the handler used for event processing. This must only be called by PaginatorBuilder.
      Parameters:
      handler - The handler that'll be used for event processing (must be either JDA or ShardManager).
    • isRemoveOnReact

      public boolean isRemoveOnReact()
      Retrieves whether user reactions will be removed after pressing the button or not.
      If this is enabled, the bot will require Permission.MESSAGE_MANAGE permission for the buttons to work.
      Returns:
      Whether reactions will be removed on press or not.
    • setRemoveOnReact

      protected void setRemoveOnReact(boolean removeOnReact)
      Set whether user reactions will be removed after pressing the button or not. This must only be called by PaginatorBuilder.
      Parameters:
      removeOnReact - Whether reactions will be removed on press or not.
    • isEventLocked

      public boolean isEventLocked()
      Retrieves whether events will be locked to prevent double-activation of buttons before it finished previous processing (can help if experiencing race condition).
      Returns:
      Whether events will be hash-locked.
    • setEventLocked

      protected void setEventLocked(boolean hashLocking)
      Set whether evens should be locked to prevent double-activation. This must only be called by PaginatorBuilder.
      Parameters:
      hashLocking - Whether events should be locked.
    • isDeleteOnCancel

      public boolean isDeleteOnCancel()
      Retrieves whether the Message should be deleted or not when the button handler is removed.
      If this is enabled, the bot will require Permission.MESSAGE_MANAGE permission for the deletion to work.
      Returns:
      Whether the Message will be deleted or not.
    • setDeleteOnCancel

      protected void setDeleteOnCancel(boolean deleteOnCancel)
      Set whether Message should be deleted or not when the button handler is removed. This must only be called by PaginatorBuilder.
      Parameters:
      deleteOnCancel - Whether the Message will be deleted or not.
    • getEmotes

      public Map<Emote,​net.dv8tion.jda.api.entities.emoji.Emoji> getEmotes()
      The Map containing configured Emotes for this Paginator. This Map must not be modified after construction of this Paginator.
      Returns:
      The Map containing configured Emotes for this Paginator.
    • getEmoji

      public net.dv8tion.jda.api.entities.emoji.Emoji getEmoji(Emote emote)
      Retrieves the Emoji assigned to the supplied Emote.
      Parameters:
      emote - The Emote to be defined.
      Returns:
      The Emoji representing this Emote.
    • finishEmotes

      protected void finishEmotes()
      Make configured Emotes final. This must only be called by PaginatorBuilder.
    • getLogger

      public org.slf4j.Logger getLogger()
      Retrieves Logger instance used by the library. For better maintenance, it's preferred not to use this for outside logging.
      Returns:
      The Logger used by Pagination Utils.
    • log

      public void log(PUtilsConfig.LogLevel level, String msg, Throwable t)
      Utility method to log an error at the supplied PUtilsConfig.LogLevel. For better maintenance, do not use this outside of the library..
      Parameters:
      level - The PUtilsConfig.LogLevel to be used.
      msg - The message to be logged.
      t - The Throwable to be added for more detailed information.
    • log

      public void log(PUtilsConfig.LogLevel level, String msg)
      Utility method to log an error at the supplied PUtilsConfig.LogLevel. For better maintenance, do not use this outside of the library..
      Parameters:
      level - The PUtilsConfig.LogLevel to be used.
      msg - The message to be logged.