public final class CommandManager extends Object implements jline.console.completer.Completer
| Modifier and Type | Field and Description |
|---|---|
private Map<String,Command> |
commands |
private ConsoleCommandSender |
consoleSender |
| Constructor and Description |
|---|
CommandManager()
Constructs a new command manager with a
ConsoleCommandSender and
no commands. |
| Modifier and Type | Method and Description |
|---|---|
CommandManager |
clearCommands()
Clears all the commands that are currently registered.
|
int |
complete(String buffer,
int cursor,
List<CharSequence> candidates) |
boolean |
dispatchCommand(CommandSender sender,
String command)
Parses the given
command and dispatches it using the
given sender. |
boolean |
dispatchCommand(String command)
Parses the given
command from the console and dispatches it using
a ConsoleCommandSender. |
Command |
getCommand(String name)
Get the command for a given name.
|
Set<String> |
getCommands()
Get the registered commands.
|
ConsoleCommandSender |
getConsoleSender() |
CommandManager |
registerCommand(Command command)
Register a new command and all of its aliases to this command manager.
|
private ConsoleCommandSender consoleSender
public CommandManager()
ConsoleCommandSender and
no commands.public CommandManager clearCommands()
public CommandManager registerCommand(Command command)
command - the command to registerpublic Set<String> getCommands()
public ConsoleCommandSender getConsoleSender()
public boolean dispatchCommand(String command)
command from the console and dispatches it using
a ConsoleCommandSender.
CommandArgument handlers.Command is executed with the processed commandscommand - the command line to parse and dispatchdispatchCommand(CommandSender, String)public boolean dispatchCommand(CommandSender sender, String command)
command and dispatches it using the
given sender.
CommandArgument handlers.Command is executed with the processed commandssender - the sender to execute the command ascommand - the command line to parse and dispatchpublic int complete(String buffer, int cursor, List<CharSequence> candidates)
complete in interface jline.console.completer.CompleterCopyright © 2020. All rights reserved.