Package com.github.ygimenez.model
Class Paginator
java.lang.Object
com.github.ygimenez.model.Paginator
This is the core object for Pagination-Utils' settings.
All settings changed during
This class must only be instantiated by
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 Summary
ConstructorsModifierConstructorDescriptionprotectedYou shouldn't create aPaginatorinstance directly, please usePaginatorBuilder.You shouldn't create aPaginatorinstance directly, please usePaginatorBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMake configuredEmotes final.net.dv8tion.jda.api.entities.emoji.EmojiRetrieves theEmojiassigned to the suppliedEmote.Retrieves the handler used during thisPaginator's construction.org.slf4j.LoggerRetrievesLoggerinstance used by the library.booleanRetrieves whether theMessageshould be deleted or not when the button handler is removed.
If this is enabled, the bot will requirePermission.MESSAGE_MANAGEpermission for the deletion to work.booleanRetrieves whether events will be locked to prevent double-activation of buttons before it finished previous processing (can help if experiencing race condition).booleanRetrieves whether user reactions will be removed after pressing the button or not.
If this is enabled, the bot will requirePermission.MESSAGE_MANAGEpermission for the buttons to work.voidlog(PUtilsConfig.LogLevel level, String msg)Utility method to log an error at the suppliedPUtilsConfig.LogLevel.voidlog(PUtilsConfig.LogLevel level, String msg, Throwable t)Utility method to log an error at the suppliedPUtilsConfig.LogLevel.protected voidsetDeleteOnCancel(boolean deleteOnCancel)Set whetherMessageshould be deleted or not when the button handler is removed.protected voidsetEventLocked(boolean hashLocking)Set whether evens should be locked to prevent double-activation.protected voidsetHandler(Object handler)Set the handler used for event processing.protected voidsetRemoveOnReact(boolean removeOnReact)Set whether user reactions will be removed after pressing the button or not.
-
Constructor Details
-
Paginator
protected Paginator()You shouldn't create aPaginatorinstance directly, please usePaginatorBuilder. -
Paginator
You shouldn't create aPaginatorinstance directly, please usePaginatorBuilder.- Parameters:
handler- The handler that'll be used for event processing (must be eitherJDAorShardManager).
-
-
Method Details
-
getHandler
Retrieves the handler used during thisPaginator's construction.- Returns:
- The handler object (will be either
JDAorShardManager).
-
setHandler
Set the handler used for event processing. This must only be called byPaginatorBuilder.- Parameters:
handler- The handler that'll be used for event processing (must be eitherJDAorShardManager).
-
isRemoveOnReact
public boolean isRemoveOnReact()Retrieves whether user reactions will be removed after pressing the button or not.
If this is enabled, the bot will requirePermission.MESSAGE_MANAGEpermission 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 byPaginatorBuilder.- 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 byPaginatorBuilder.- Parameters:
hashLocking- Whether events should be locked.
-
isDeleteOnCancel
public boolean isDeleteOnCancel()Retrieves whether theMessageshould be deleted or not when the button handler is removed.
If this is enabled, the bot will requirePermission.MESSAGE_MANAGEpermission for the deletion to work.- Returns:
- Whether the
Messagewill be deleted or not.
-
setDeleteOnCancel
protected void setDeleteOnCancel(boolean deleteOnCancel)Set whetherMessageshould be deleted or not when the button handler is removed. This must only be called byPaginatorBuilder.- Parameters:
deleteOnCancel- Whether theMessagewill be deleted or not.
-
getEmotes
-
getEmoji
Retrieves theEmojiassigned to the suppliedEmote. -
finishEmotes
protected void finishEmotes()Make configuredEmotes final. This must only be called byPaginatorBuilder. -
getLogger
public org.slf4j.Logger getLogger()RetrievesLoggerinstance used by the library. For better maintenance, it's preferred not to use this for outside logging.- Returns:
- The
Loggerused by Pagination Utils.
-
log
Utility method to log an error at the suppliedPUtilsConfig.LogLevel. For better maintenance, do not use this outside of the library..- Parameters:
level- ThePUtilsConfig.LogLevelto be used.msg- The message to be logged.t- TheThrowableto be added for more detailed information.
-
log
Utility method to log an error at the suppliedPUtilsConfig.LogLevel. For better maintenance, do not use this outside of the library..- Parameters:
level- ThePUtilsConfig.LogLevelto be used.msg- The message to be logged.
-