Class AbstractCommandManager<B,S>
java.lang.Object
io.github.mqzn.commands.base.manager.AbstractCommandManager<B,S>
- Type Parameters:
B
- The bootstrap for the lib to work onS
- The command sender type
- All Implemented Interfaces:
CommandManager<B,
S>
The class responsible for handling,
registering, and coordinating the execution of the
available commands
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final @NotNull ArgumentNumberSuggestionProcessor
protected final B
protected final @NotNull CaptionRegistry<S>
protected final Logger
protected final @NotNull SenderProviderRegistry<S>
protected final @NotNull SenderWrapper<S>
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommandManager
(B bootstrap, @NotNull SenderWrapper<S> wrapper) AbstractCommandManager
(B bootstrap, @NotNull SenderWrapper<S> wrapper, CommandExecutionCoordinator.Type coordinator) -
Method Summary
Modifier and TypeMethodDescription@NotNull CaptionRegistry<S>
The registry that holds all the captions that will be used during command execution@NotNull CommandExceptionHandler<S>
The exception handler which handles exceptions during execution stage.final <C> void
executeCommand
(@NotNull Command<S> command, S sender, @NotNull String[] args) Executes a command asynchronously OR synchronously using the execution coordinatorCommandExecutionCoordinator<S>
@NotNull List<CommandSyntax<S>>
findAmbiguity
(@NotNull Command<S> command) Finds syntaxes that are ambigiousio.github.mqzn.commands.base.syntax.tree.CommandTree.CommandSearchResult<S>
findSyntax
(@NotNull Command<S> command, @NotNull DelegateCommandContext<S> commandContext) Finds the most suitable syntax for the context that is being executed@NotNull FlagRegistry
The registry that holds all the flags that will be handled during command executionThe bootstrap for the platform on which the manager is being used ongetCommand
(String name) Gets a command which is already registered@NotNull Collection<Command<S>>
All registered commands@NotNull SenderWrapper<S>
The wrapper for sending messages across different platforms@Nullable CommandHelpProvider<S>
Fetches the command help provider during command execution of '/cmd help'void
@NotNull ArgumentNumberSuggestionProcessor
Numeric argument suggestion processorregisterCommand
(C command) Registers a command in the platform@NotNull SenderProviderRegistry<S>
The registry that holds all custom sender providers that will be used during command executionvoid
setHelpProvider
(@Nullable CommandHelpProvider<S> helpProvider) Sets the help menu provider for all commands registeredSuggests the suggestions in correspond to the args being used while tab completing and to the command arguments of course !@NotNull SuggestionProviderRegistry
The suggestion provider registry@NotNull ArgumentTypeRegistry
The argument types registry which contains all types of arguments that will be handled during executionvoid
unregisterCommand
(String name) Unregisters the commandMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.mqzn.commands.base.manager.CommandManager
commandPrefix, handleHelpRequest
-
Field Details
-
logger
-
bootstrap
-
argumentNumberSuggestionProcessor
@NotNull protected final @NotNull ArgumentNumberSuggestionProcessor argumentNumberSuggestionProcessor -
wrapper
-
captionRegistry
-
senderProviderRegistry
-
-
Constructor Details
-
AbstractCommandManager
public AbstractCommandManager(@NotNull B bootstrap, @NotNull @NotNull SenderWrapper<S> wrapper, @NotNull CommandExecutionCoordinator.Type coordinator) -
AbstractCommandManager
-
-
Method Details
-
getBootstrap
Description copied from interface:CommandManager
The bootstrap for the platform on which the manager is being used on- Specified by:
getBootstrap
in interfaceCommandManager<B,
S> - Returns:
- the bootstrap instance
-
typeRegistry
Description copied from interface:CommandManager
The argument types registry which contains all types of arguments that will be handled during execution- Specified by:
typeRegistry
in interfaceCommandManager<B,
S> - Returns:
- the argument type registry
-
suggestionProviderRegistry
Description copied from interface:CommandManager
The suggestion provider registry- Specified by:
suggestionProviderRegistry
in interfaceCommandManager<B,
S> - Returns:
- the provider registry for suggestions per argument
- See Also:
-
exceptionHandler
Description copied from interface:CommandManager
The exception handler which handles exceptions during execution stage.- Specified by:
exceptionHandler
in interfaceCommandManager<B,
S> - Returns:
- the exception handler
-
helpProvider
Description copied from interface:CommandManager
Fetches the command help provider during command execution of '/cmd help'- Specified by:
helpProvider
in interfaceCommandManager<B,
S> - Returns:
- the sender provider registry
- See Also:
-
setHelpProvider
Description copied from interface:CommandManager
Sets the help menu provider for all commands registered- Specified by:
setHelpProvider
in interfaceCommandManager<B,
S> - Parameters:
helpProvider
- the new help provider
-
executeCommand
public final <C> void executeCommand(@NotNull @NotNull Command<S> command, @NotNull S sender, @NotNull @NotNull String[] args) Description copied from interface:CommandManager
Executes a command asynchronously OR synchronously using the execution coordinatorCommandExecutionCoordinator<S>
- Specified by:
executeCommand
in interfaceCommandManager<B,
S> - Type Parameters:
C
- the type of the custom sender- Parameters:
command
- the command to executesender
- the command senderargs
- the arguments used
-
findSyntax
public io.github.mqzn.commands.base.syntax.tree.CommandTree.CommandSearchResult<S> findSyntax(@NotNull @NotNull Command<S> command, @NotNull @NotNull DelegateCommandContext<S> commandContext) Description copied from interface:CommandManager
Finds the most suitable syntax for the context that is being executed- Specified by:
findSyntax
in interfaceCommandManager<B,
S> - Parameters:
command
- the command being executedcommandContext
- the delegate command context (context containing only raws)- Returns:
- the traversing result of the search
-
getSenderWrapper
Description copied from interface:CommandManager
The wrapper for sending messages across different platforms- Specified by:
getSenderWrapper
in interfaceCommandManager<B,
S> - Returns:
- the sender wrapper
-
registerCommand
Description copied from interface:CommandManager
Registers a command in the platform- Specified by:
registerCommand
in interfaceCommandManager<B,
S> - Type Parameters:
C
- the type of the command class- Parameters:
command
- the command instance
-
unregisterCommand
Description copied from interface:CommandManager
Unregisters the command- Specified by:
unregisterCommand
in interfaceCommandManager<B,
S> - Parameters:
name
- the command to unregister
-
getCommand
Description copied from interface:CommandManager
Gets a command which is already registered- Specified by:
getCommand
in interfaceCommandManager<B,
S> - Parameters:
name
- the command's name to fetch- Returns:
- the registered command that goes by a specific name returns null if no command with that name was registered !
-
getCommands
Description copied from interface:CommandManager
All registered commands- Specified by:
getCommands
in interfaceCommandManager<B,
S> - Returns:
- all registered commands
-
flagRegistry
Description copied from interface:CommandManager
The registry that holds all the flags that will be handled during command execution- Specified by:
flagRegistry
in interfaceCommandManager<B,
S> - Returns:
- the flags registry
- See Also:
-
captionRegistry
Description copied from interface:CommandManager
The registry that holds all the captions that will be used during command execution- Specified by:
captionRegistry
in interfaceCommandManager<B,
S> - Returns:
- the ca registry
- See Also:
-
senderProviderRegistry
Description copied from interface:CommandManager
The registry that holds all custom sender providers that will be used during command execution- Specified by:
senderProviderRegistry
in interfaceCommandManager<B,
S> - Returns:
- the sender provider registry
- See Also:
-
suggest
Description copied from interface:CommandManager
Suggests the suggestions in correspond to the args being used while tab completing and to the command arguments of course !- Specified by:
suggest
in interfaceCommandManager<B,
S> - Parameters:
command
- the command being used while tab completingsender
- the senderargs
- the args- Returns:
- the suggestions
-
findAmbiguity
Description copied from interface:CommandManager
Finds syntaxes that are ambigious- Specified by:
findAmbiguity
in interfaceCommandManager<B,
S> - Parameters:
command
- the syntaxes provider to check upon for ambiguity- Returns:
- the ambigious syntaxes
-
numericArgumentSuggestionProcessor
Description copied from interface:CommandManager
Numeric argument suggestion processor- Specified by:
numericArgumentSuggestionProcessor
in interfaceCommandManager<B,
S> - Returns:
- the processor of numeric args suggestions
-
log
- Specified by:
log
in interfaceCommandManager<B,
S>
-