public abstract class BaseCommand extends Object
It is up to the end user how to organize their command. you could use 1 base command per command in your application.
Optionally (and encouraged), you can use the base command to represent a root command, and then each actionable command is a sub command
| Constructor and Description |
|---|
BaseCommand() |
BaseCommand(@Nullable String cmd)
Deprecated.
Please switch to
CommandAlias for defining all root commands. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canExecute(CommandIssuer issuer,
RegisteredCommand<?> cmd)
Deprecated.
|
void |
doHelp(CommandIssuer issuer,
String... args) |
void |
doHelp(Object issuer,
String... args) |
void |
execute(CommandIssuer issuer,
String commandLabel,
String[] args) |
CommandHelp |
getCommandHelp()
Deprecated.
Unstable API
|
String |
getContextFlags(Class<?> cls) |
CommandIssuer |
getCurrentCommandIssuer()
Gets the current command issuer.
|
CommandManager |
getCurrentCommandManager()
Gets the current command manager.
|
RegisteredCommand |
getDefaultRegisteredCommand() |
ExceptionHandler |
getExceptionHandler() |
String |
getExecCommandLabel()
Gets the root command name that the user actually typed
|
String |
getExecSubcommand()
Gets the actual sub command name the user typed
|
CommandOperationContext |
getLastCommandOperationContext()
Returns a reference to the last used CommandOperationContext.
|
String |
getName() |
String[] |
getOrigArgs()
Gets the actual args in string form the user typed
|
List<RegisteredCommand> |
getRegisteredCommands() |
Set<String> |
getRequiredPermissions() |
boolean |
hasPermission(CommandIssuer issuer) |
boolean |
hasPermission(Object issuer) |
void |
help(CommandIssuer issuer,
String[] args) |
void |
help(Object issuer,
String[] args) |
boolean |
requiresPermission(String permission) |
String |
setContextFlags(Class<?> cls,
String flags) |
BaseCommand |
setExceptionHandler(ExceptionHandler exceptionHandler) |
void |
showCommandHelp()
Deprecated.
Unstable API
|
void |
showSyntax(CommandIssuer issuer,
RegisteredCommand<?> cmd) |
List<String> |
tabComplete(CommandIssuer issuer,
String commandLabel,
String[] args)
Gets tab completed data from the given command from the user.
|
List<String> |
tabComplete(CommandIssuer issuer,
String commandLabel,
String[] args,
boolean isAsync)
Gets the tab complete suggestions from a given command.
|
public BaseCommand()
@Deprecated public BaseCommand(@Nullable @Nullable String cmd)
CommandAlias for defining all root commands.cmd - public CommandOperationContext getLastCommandOperationContext()
public String getExecCommandLabel()
public String getExecSubcommand()
public String[] getOrigArgs()
public void execute(CommandIssuer issuer, String commandLabel, String[] args)
public CommandIssuer getCurrentCommandIssuer()
public CommandManager getCurrentCommandManager()
@Deprecated public boolean canExecute(CommandIssuer issuer, RegisteredCommand<?> cmd)
CommandConditionsissuer - cmd - public List<String> tabComplete(CommandIssuer issuer, String commandLabel, String[] args)
issuer - The user who executed the tabcomplete.commandLabel - The label which is being used by the user.args - The arguments the user has typed so far.public List<String> tabComplete(CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) throws IllegalArgumentException
issuer - The issuer of the command.commandLabel - The command name as entered by the user instead of the ACF registered name.args - All arguments entered by the user.isAsync - Whether this is run off of the main thread.IllegalArgumentException@Deprecated public CommandHelp getCommandHelp()
@Deprecated public void showCommandHelp()
public void help(CommandIssuer issuer, String[] args)
public void doHelp(CommandIssuer issuer, String... args)
public void showSyntax(CommandIssuer issuer, RegisteredCommand<?> cmd)
public boolean hasPermission(Object issuer)
public boolean hasPermission(CommandIssuer issuer)
public Set<String> getRequiredPermissions()
public boolean requiresPermission(String permission)
public ExceptionHandler getExceptionHandler()
public BaseCommand setExceptionHandler(ExceptionHandler exceptionHandler)
public RegisteredCommand getDefaultRegisteredCommand()
public String setContextFlags(Class<?> cls, String flags)
public String getContextFlags(Class<?> cls)
public List<RegisteredCommand> getRegisteredCommands()
Copyright © 2019. All rights reserved.