Interface ModuleCommandController
public interface ModuleCommandController
Registers module commands with the command framework and keeps track of their argument
names, which are translatable and therefore differ per language.
-
Method Summary
Modifier and TypeMethodDescriptionaddPrompt(ModuleCommand command, int index, Function<Localization.Command.Prompt, String> promptLocalization) Registers the translated name of one argument and returns it.voidclearPrompts(ModuleCommand abstractModuleCommand) Forgets a command's argument names, so they are rebuilt after a language change.<V extends @NonNull Object>
VgetArgument(ModuleCommand command, org.incendo.cloud.context.CommandContext<FPlayer> context, int promptIndex) Reads a parsed argument by position rather than by its translated name.getCommandName(ModuleCommand command) The primary alias a command is registered under.getPrompt(ModuleCommand command, int index) The registered name of one argument.getPrompts(ModuleCommand command) Every registered argument name for a command, in order.voidregisterCommand(ModuleCommand command, UnaryOperator<org.incendo.cloud.Command.Builder<FPlayer>> builder) Registers a command under every alias in its config.voidregisterSubCommand(ModuleCommand command, String subName, UnaryOperator<org.incendo.cloud.Command.Builder<FPlayer>> builder) Registers an extra literal form of an already registered command.
-
Method Details
-
registerCommand
void registerCommand(ModuleCommand command, UnaryOperator<org.incendo.cloud.Command.Builder<FPlayer>> builder) Registers a command under every alias in its config.- Parameters:
command- the module that handles itbuilder- describes the arguments
-
registerSubCommand
void registerSubCommand(ModuleCommand command, String subName, UnaryOperator<org.incendo.cloud.Command.Builder<FPlayer>> builder) Registers an extra literal form of an already registered command.- Parameters:
command- the module that handles itsubName- the literal that follows the command namebuilder- describes the remaining arguments
-
clearPrompts
Forgets a command's argument names, so they are rebuilt after a language change.- Parameters:
abstractModuleCommand- the command to clear
-
addPrompt
String addPrompt(ModuleCommand command, int index, Function<Localization.Command.Prompt, String> promptLocalization) Registers the translated name of one argument and returns it.- Parameters:
command- the command the argument belongs toindex- the argument positionpromptLocalization- picks the name out of the localization file- Returns:
- the registered name
-
getPrompt
The registered name of one argument.- Parameters:
command- the command the argument belongs toindex- the argument position- Returns:
- the argument name
-
getPrompts
Every registered argument name for a command, in order.- Parameters:
command- the command- Returns:
- the argument names
-
getArgument
<V extends @NonNull Object> V getArgument(ModuleCommand command, org.incendo.cloud.context.CommandContext<FPlayer> context, int promptIndex) Reads a parsed argument by position rather than by its translated name.- Type Parameters:
V- the argument type- Parameters:
command- the command the argument belongs tocontext- the parsed argumentspromptIndex- the argument position- Returns:
- the parsed value
-
getCommandName
The primary alias a command is registered under.- Parameters:
command- the command- Returns:
- the command name
-