SimpleCommandMap
public interface CommandMap
Modifier and Type | Method | Description |
---|---|---|
void |
clearCommands() |
Clears all registered commands.
|
boolean |
dispatch(CommandSender sender,
java.lang.String cmdLine) |
Looks for the requested command and executes it if found.
|
Command |
getCommand(java.lang.String name) |
Gets the command registered to the specified name
|
boolean |
register(java.lang.String label,
java.lang.String fallbackPrefix,
Command command) |
Registers a command.
|
boolean |
register(java.lang.String fallbackPrefix,
Command command) |
Registers a command.
|
void |
registerAll(java.lang.String fallbackPrefix,
java.util.List<Command> commands) |
Registers all the commands belonging to a certain plugin.
|
java.util.List<java.lang.String> |
tabComplete(CommandSender sender,
java.lang.String cmdLine) |
Looks for the requested command and executes an appropriate
tab-completer if found.
|
java.util.List<java.lang.String> |
tabComplete(CommandSender sender,
java.lang.String cmdLine,
Location location) |
Looks for the requested command and executes an appropriate
tab-completer if found.
|
void registerAll(java.lang.String fallbackPrefix, java.util.List<Command> commands)
Caller can use:-
fallbackPrefix
- a prefix which is prepended to each command with
a ':' one or more times to make the command uniquecommands
- a list of commands to registerboolean register(java.lang.String label, java.lang.String fallbackPrefix, Command command)
Caller can use:-
label
- the label of the command, without the '/'-prefix.fallbackPrefix
- a prefix which is prepended to the command with a
':' one or more times to make the command uniquecommand
- the command to registerboolean register(java.lang.String fallbackPrefix, Command command)
Caller can use:-
fallbackPrefix
- a prefix which is prepended to the command with a
':' one or more times to make the command uniquecommand
- the command to register, from which label is determined
from the command nameboolean dispatch(CommandSender sender, java.lang.String cmdLine) throws CommandException
sender
- The command's sendercmdLine
- command + arguments. Example: "/test abc 123"CommandException
- Thrown when the executor for the given command
fails with an unhandled exceptionvoid clearCommands()
Command getCommand(java.lang.String name)
name
- Name of the command to retrievejava.util.List<java.lang.String> tabComplete(CommandSender sender, java.lang.String cmdLine) throws java.lang.IllegalArgumentException
sender
- The command's sender.cmdLine
- The entire command string to tab-complete, excluding
initial slash.CommandException
- Thrown when the tab-completer for the given
command fails with an unhandled exceptionjava.lang.IllegalArgumentException
- if either sender or cmdLine are nulljava.util.List<java.lang.String> tabComplete(CommandSender sender, java.lang.String cmdLine, Location location) throws java.lang.IllegalArgumentException
sender
- The command's sender.cmdLine
- The entire command string to tab-complete, excluding
initial slash.location
- The position looked at by the sender, or null if noneCommandException
- Thrown when the tab-completer for the given
command fails with an unhandled exceptionjava.lang.IllegalArgumentException
- if either sender or cmdLine are nullCopyright © 2018. All rights reserved.