Package org.bukkit.command
Class SimpleCommandMap
java.lang.Object
org.bukkit.command.SimpleCommandMap
- All Implemented Interfaces:
- CommandMap
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidClears all registered commands.booleandispatch(CommandSender sender, String commandLine) Looks for the requested command and executes it if found.getCommand(String name) Gets the command registered to the specified namebooleanRegisters a command.booleanRegisters a command.voidregisterAll(String fallbackPrefix, List<Command> commands) Registers all the commands belonging to a certain plugin.voidvoidtabComplete(CommandSender sender, String cmdLine) Looks for the requested command and executes an appropriate tab-completer if found.tabComplete(CommandSender sender, String cmdLine, Location location) Looks for the requested command and executes an appropriate tab-completer if found.
- 
Field Details- 
knownCommands
 
- 
- 
Constructor Details- 
SimpleCommandMap
 
- 
- 
Method Details- 
setFallbackCommandspublic void setFallbackCommands()
- 
registerAllRegisters all the commands belonging to a certain plugin.Caller can use:- - command.getName() to determine the label registered for this command
- command.getAliases() to determine the aliases which where registered
 - Specified by:
- registerAllin interface- CommandMap
- Parameters:
- fallbackPrefix- a prefix which is prepended to each command with a ':' one or more times to make the command unique
- commands- a list of commands to register
 
- 
registerRegisters a command. Returns true on success; false if name is already taken and fallback had to be used.Caller can use:- - command.getName() to determine the label registered for this command
- command.getAliases() to determine the aliases which where registered
 - Specified by:
- registerin interface- CommandMap
- Parameters:
- fallbackPrefix- a prefix which is prepended to the command with a ':' one or more times to make the command unique
- command- the command to register, from which label is determined from the command name
- Returns:
- true if command was registered with the passed in label, false otherwise, which indicates the fallbackPrefix was used one or more times
 
- 
registerpublic boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) Registers a command. Returns true on success; false if name is already taken and fallback had to be used.Caller can use:- - command.getName() to determine the label registered for this command
- command.getAliases() to determine the aliases which where registered
 - Specified by:
- registerin interface- CommandMap
- Parameters:
- 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 unique
- command- the command to register
- Returns:
- true if command was registered with the passed in label, false otherwise, which indicates the fallbackPrefix was used one or more times
 
- 
dispatchpublic boolean dispatch(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException Looks for the requested command and executes it if found.- Specified by:
- dispatchin interface- CommandMap
- Parameters:
- sender- The command's sender
- commandLine- command + arguments. Example: "/test abc 123"
- Returns:
- returns false if no target is found, true otherwise.
- Throws:
- CommandException- Thrown when the executor for the given command fails with an unhandled exception
 
- 
clearCommandspublic void clearCommands()Description copied from interface:CommandMapClears all registered commands.- Specified by:
- clearCommandsin interface- CommandMap
 
- 
getCommandDescription copied from interface:CommandMapGets the command registered to the specified name- Specified by:
- getCommandin interface- CommandMap
- Parameters:
- name- Name of the command to retrieve
- Returns:
- Command with the specified name or null if a command with that label doesn't exist
 
- 
tabCompleteDescription copied from interface:CommandMapLooks for the requested command and executes an appropriate tab-completer if found. This method will also tab-complete partial commands.- Specified by:
- tabCompletein interface- CommandMap
- Parameters:
- sender- The command's sender.
- cmdLine- The entire command string to tab-complete, excluding initial slash.
- Returns:
- a list of possible tab-completions. This list may be immutable. Will be null if no matching command of which sender has permission.
 
- 
tabComplete@Nullable public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) Description copied from interface:CommandMapLooks for the requested command and executes an appropriate tab-completer if found. This method will also tab-complete partial commands.- Specified by:
- tabCompletein interface- CommandMap
- Parameters:
- 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 none
- Returns:
- a list of possible tab-completions. This list may be immutable. Will be null if no matching command of which sender has permission.
 
- 
getCommands
- 
registerServerAliasespublic void registerServerAliases()
 
-