Package cloud.commandframework.pircbotx
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
Modifier and TypeFieldDescriptionstatic final String
Default caption forARGUMENT_PARSE_FAILURE_USER_KEY
static final cloud.commandframework.captions.Caption
Variables: {input}static final String
Meta key for accessing thePircBotX
instance from aCommandContext
instance -
Constructor Summary
ConstructorDescriptionPircBotXCommandManager
(@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 TypeMethodDescriptionfinal @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
-
Field Details
-
PIRCBOTX_META_KEY
Meta key for accessing thePircBotX
instance from aCommandContext
instance- See Also:
-
ARGUMENT_PARSE_FAILURE_USER_KEY
public static final cloud.commandframework.captions.Caption ARGUMENT_PARSE_FAILURE_USER_KEYVariables: {input} -
ARGUMENT_PARSE_FAILURE_USER
Default caption forARGUMENT_PARSE_FAILURE_USER_KEY
- 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 theListenerAdapter
that will forward commands to the command dispatchercommandExecutionCoordinator
- 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 betweenCommandExecutionCoordinator.simpleCoordinator()
andAsynchronousCommandExecutionCoordinator
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 registrationpermissionFunction
- 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 betrue
if the sender is permitted to use the command, elsefalse
userMapper
- Function that mapsusers
to the custom command sender typecommandPrefix
- The prefix that must be applied to all commands for the command to be valid
-
-
Method Details
-
hasPermission
- Specified by:
hasPermission
in classcloud.commandframework.CommandManager<C>
-
createDefaultCommandMeta
public final @NonNull cloud.commandframework.meta.CommandMeta createDefaultCommandMeta()- Specified by:
createDefaultCommandMeta
in classcloud.commandframework.CommandManager<C>
-
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
-