Interface CommandManager<B,S>
- All Known Implementing Classes:
AbstractCommandManager
public interface CommandManager<B,S>
-
Method Summary
Modifier and TypeMethodDescription@NotNull CaptionRegistry<S>
The registry that holds all the captions that will be used during command executionchar
The prefix of all commands@NotNull CommandExceptionHandler<S>
The exception handler which handles exceptions during execution stage.<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, DelegateCommandContext<S> delegateContext) 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 platformsdefault void
handleHelpRequest
(S sender, @NotNull Context<S> context, @NotNull String label, int page, @NotNull List<? extends CommandSyntax<S>> syntaxes) @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 command
-
Method Details
-
getBootstrap
The bootstrap for the platform on which the manager is being used on- Returns:
- the bootstrap instance
-
exceptionHandler
The exception handler which handles exceptions during execution stage.- Returns:
- the exception handler
-
executeCommand
<C> void executeCommand(@NotNull @NotNull Command<S> command, @NotNull S sender, @NotNull @NotNull String[] args) Executes a command asynchronously OR synchronously using the execution coordinatorCommandExecutionCoordinator<S>
- Type Parameters:
C
- the type of the custom sender- Parameters:
command
- the command to executesender
- the command senderargs
- the arguments used
-
getSenderWrapper
The wrapper for sending messages across different platforms- Returns:
- the sender wrapper
-
typeRegistry
The argument types registry which contains all types of arguments that will be handled during execution- Returns:
- the argument type registry
-
commandPrefix
char commandPrefix()The prefix of all commands- Returns:
- the prefix
-
registerCommand
Registers a command in the platform- Type Parameters:
C
- the type of the command class- Parameters:
command
- the command instance
-
unregisterCommand
Unregisters the command- Parameters:
name
- the command to unregister
-
getCommand
Gets a command which is already registered- 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
All registered commands- Returns:
- all registered commands
-
flagRegistry
The registry that holds all the flags that will be handled during command execution- Returns:
- the flags registry
- See Also:
-
captionRegistry
The registry that holds all the captions that will be used during command execution- Returns:
- the ca registry
- See Also:
-
senderProviderRegistry
The registry that holds all custom sender providers that will be used during command execution- Returns:
- the sender provider registry
- See Also:
-
helpProvider
Fetches the command help provider during command execution of '/cmd help'- Returns:
- the sender provider registry
- See Also:
-
setHelpProvider
Sets the help menu provider for all commands registered- Parameters:
helpProvider
- the new help provider
-
findAmbiguity
Finds syntaxes that are ambigious- Parameters:
command
- the syntaxes provider to check upon for ambiguity- Returns:
- the ambigious syntaxes
-
findSyntax
io.github.mqzn.commands.base.syntax.tree.CommandTree.CommandSearchResult<S> findSyntax(@NotNull @NotNull Command<S> command, DelegateCommandContext<S> delegateContext) Finds the most suitable syntax for the context that is being executed- Parameters:
command
- the command being executeddelegateContext
- the delegate command context (context containing only raws)- Returns:
- the traversing result of the search
-
suggest
Suggests the suggestions in correspond to the args being used while tab completing and to the command arguments of course !- Parameters:
command
- the command being used while tab completingsender
- the senderargs
- the args- Returns:
- the suggestions
-
numericArgumentSuggestionProcessor
Numeric argument suggestion processor- Returns:
- the processor of numeric args suggestions
-
suggestionProviderRegistry
The suggestion provider registry- Returns:
- the provider registry for suggestions per argument
- See Also:
-
log
-
handleHelpRequest
default void handleHelpRequest(@NotNull S sender, @NotNull @NotNull Context<S> context, @NotNull @NotNull String label, int page, @NotNull @NotNull List<? extends CommandSyntax<S>> syntaxes) throws IllegalArgumentException - Throws:
IllegalArgumentException
-