Class PircBotXCommandManager<C>

java.lang.Object
cloud.commandframework.CommandManager<C>
cloud.commandframework.pircbotx.PircBotXCommandManager<C>
Type Parameters:
C - Command sender type

public class PircBotXCommandManager<C> extends cloud.commandframework.CommandManager<C>
Command manager implementation for PircBotX 2.0
Since:
1.1.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class cloud.commandframework.CommandManager

    cloud.commandframework.CommandManager.ManagerSettings, cloud.commandframework.CommandManager.RegistrationState
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    static final cloud.commandframework.captions.Caption
    Variables: {input}
    static final String
    Meta key for accessing the PircBotX instance from a CommandContext instance
  • Constructor Summary

    Constructors
    Constructor
    Description
    PircBotXCommandManager(@NonNull org.pircbotx.PircBotX pircBotX, @NonNull Function<@NonNull cloud.commandframework.CommandTree<C>,@NonNull cloud.commandframework.execution.CommandExecutionCoordinator<C>> commandExecutionCoordinator, @NonNull cloud.commandframework.internal.CommandRegistrationHandler commandRegistrationHandler, @NonNull BiFunction<C,String,Boolean> permissionFunction, @NonNull Function<org.pircbotx.User,C> userMapper, @NonNull String commandPrefix)
    Create a new command manager instance
  • Method Summary

    Modifier and Type
    Method
    Description
    final @NonNull cloud.commandframework.meta.CommandMeta
     
    final @NonNull String
    Get the command prefix.
    final boolean
    hasPermission(@NonNull C sender, @NonNull String permission)
     

    Methods inherited from class cloud.commandframework.CommandManager

    argumentBuilder, capabilities, captionRegistry, captionRegistry, captionVariableReplacementHandler, captionVariableReplacementHandler, command, command, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandExecutionCoordinator, commandRegistrationHandler, commandRegistrationHandler, commands, commandSuggestionProcessor, commandSuggestionProcessor, commandSyntaxFormatter, commandSyntaxFormatter, commandTree, createCommandHelpHandler, createCommandHelpHandler, deleteRootCommand, executeCommand, flagBuilder, getCaptionRegistry, getCommandHelpHandler, getCommandHelpHandler, getCommandRegistrationHandler, getCommands, getCommandSuggestionProcessor, getCommandSyntaxFormatter, getCommandTree, getExceptionHandler, getParserRegistry, getRegistrationState, getSetting, handleException, hasCapability, hasPermission, isCommandRegistrationAllowed, lockRegistration, parameterInjectorRegistry, parserRegistry, postprocessContext, preprocessContext, registerCapability, registerCommandPostProcessor, registerCommandPreProcessor, registerDefaultCaptions, registerExceptionHandler, registrationState, requireState, rootCommands, setCaptionRegistry, setCommandRegistrationHandler, setCommandSuggestionProcessor, setCommandSyntaxFormatter, setSetting, suggest, transitionIfPossible, transitionOrThrow

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PIRCBOTX_META_KEY

      public static final String PIRCBOTX_META_KEY
      Meta key for accessing the PircBotX instance from a CommandContext instance
      See Also:
    • ARGUMENT_PARSE_FAILURE_USER_KEY

      public static final cloud.commandframework.captions.Caption ARGUMENT_PARSE_FAILURE_USER_KEY
      Variables: {input}
    • ARGUMENT_PARSE_FAILURE_USER

      public static final String ARGUMENT_PARSE_FAILURE_USER
      See Also:
  • Constructor Details

    • PircBotXCommandManager

      public PircBotXCommandManager(@NonNull org.pircbotx.PircBotX pircBotX, @NonNull Function<@NonNull cloud.commandframework.CommandTree<C>,@NonNull cloud.commandframework.execution.CommandExecutionCoordinator<C>> commandExecutionCoordinator, @NonNull cloud.commandframework.internal.CommandRegistrationHandler commandRegistrationHandler, @NonNull BiFunction<C,String,Boolean> permissionFunction, @NonNull Function<org.pircbotx.User,C> userMapper, @NonNull String commandPrefix)
      Create a new command manager instance
      Parameters:
      pircBotX - PircBotX instance. This is used to register the ListenerAdapter that will forward commands to the command dispatcher
      commandExecutionCoordinator - Execution coordinator instance. The coordinator is in charge of executing incoming commands. Some considerations must be made when picking a suitable execution coordinator for your platform. For example, an entirely asynchronous coordinator is not suitable when the parsers used in that particular platform are not thread safe. If you have commands that perform blocking operations, however, it might not be a good idea to use a synchronous execution coordinator. In most cases you will want to pick between CommandExecutionCoordinator.simpleCoordinator() and AsynchronousCommandExecutionCoordinator
      commandRegistrationHandler - Command registration handler. This will get called every time a new command is registered to the command manager. This may be used to forward command registration
      permissionFunction - Function used to determine whether or not a sender is permitted to use a certain command. The first input is the sender of the command, and the second parameter is the the command permission string. The return value should be true if the sender is permitted to use the command, else false
      userMapper - Function that maps users to the custom command sender type
      commandPrefix - The prefix that must be applied to all commands for the command to be valid
  • Method Details

    • hasPermission

      public final boolean hasPermission(@NonNull C sender, @NonNull String permission)
      Specified by:
      hasPermission in class cloud.commandframework.CommandManager<C>
    • createDefaultCommandMeta

      public final @NonNull cloud.commandframework.meta.CommandMeta createDefaultCommandMeta()
      Specified by:
      createDefaultCommandMeta in class cloud.commandframework.CommandManager<C>
    • getCommandPrefix

      public final @NonNull String getCommandPrefix()
      Get the command prefix. A message should be classed as a command if, and only if, it is prefixed with this prefix
      Returns:
      Command prefix