Class 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
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NonNull cloud.commandframework.meta.CommandMeta createDefaultCommandMeta()  
      @NonNull java.lang.String getCommandPrefix()
      Get the command prefix.
      boolean hasPermission​(@NonNull C sender, @NonNull java.lang.String permission)  
      • Methods inherited from class cloud.commandframework.CommandManager

        argumentBuilder, command, command, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, executeCommand, flagBuilder, getCaptionRegistry, getCommandHelpHandler, getCommandHelpHandler, getCommandRegistrationHandler, getCommands, getCommandSuggestionProcessor, getCommandSyntaxFormatter, getCommandTree, getExceptionHandler, getParserRegistry, getRegistrationState, getSetting, handleException, hasPermission, isCommandRegistrationAllowed, lockRegistration, parameterInjectorRegistry, postprocessContext, preprocessContext, registerCommandPostProcessor, registerCommandPreProcessor, registerDefaultCaptions, registerExceptionHandler, requireState, 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 Detail

      • PIRCBOTX_META_KEY

        public static final java.lang.String PIRCBOTX_META_KEY
        Meta key for accessing the PircBotX instance from a CommandContext instance
        See Also:
        Constant Field Values
      • ARGUMENT_PARSE_FAILURE_USER_KEY

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

      • PircBotXCommandManager

        public PircBotXCommandManager​(@NonNull org.pircbotx.PircBotX pircBotX,
                                      @NonNull java.util.function.Function<@NonNull cloud.commandframework.CommandTree<C>,​@NonNull cloud.commandframework.execution.CommandExecutionCoordinator<C>> commandExecutionCoordinator,
                                      @NonNull cloud.commandframework.internal.CommandRegistrationHandler commandRegistrationHandler,
                                      @NonNull java.util.function.BiFunction<C,​java.lang.String,​java.lang.Boolean> permissionFunction,
                                      @NonNull java.util.function.Function<org.pircbotx.User,​C> userMapper,
                                      @NonNull java.lang.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 Detail

      • hasPermission

        public final boolean hasPermission​(@NonNull C sender,
                                           @NonNull java.lang.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 java.lang.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