Package de.dytanic.cloudnet.command
Interface ICommandMap
-
- All Known Implementing Classes:
DefaultCommandMap
public interface ICommandMapRepresents a map from that all commands will manage.- See Also:
Command,CommandInfo,ICommandExecutor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleandispatchCommand(ICommandSender commandSender, java.lang.String commandLine)Invokes a command execute() method when there is contain in the map and parsed from the command line the additional properties.CommandgetCommand(java.lang.String name)Returns the command in the map with a specific name.CommandgetCommandFromLine(java.lang.String commandLine)Returns the command object from the custom command linejava.util.Collection<de.dytanic.cloudnet.driver.command.CommandInfo>getCommandInfos()Transform all commands instances that are contain in the map into a CommandInfo objectjava.util.Collection<java.lang.String>getCommandNames()Returns all command names that are contain in the mapvoidregisterCommand(Command command)Register a new command instance with all names that are is configureddefault voidregisterCommand(Command... commands)Register new command instances with all names that are is configuredjava.util.List<java.lang.String>tabCompleteCommand(java.lang.String commandLine)Gets all tab complete results for the specific command line.java.util.List<java.lang.String>tabCompleteCommand(java.lang.String[] args, de.dytanic.cloudnet.common.Properties properties)Gets all tab complete results for the specific command arguments and properties.voidunregisterCommand(java.lang.Class<? extends Command> command)Unregister all commands from the map, that command instance class is like the argumentdefault voidunregisterCommand(java.lang.Class<? extends Command>... commands)Unregister all commands from the map, that command instance classes is like the argumentvoidunregisterCommand(java.lang.String command)Unregister all commands from the map, that has the following string as namedefault voidunregisterCommand(java.lang.String... commands)Unregister all commands from the map, that has the following string as namevoidunregisterCommands()Remove all commands from the command mapvoidunregisterCommands(java.lang.ClassLoader classLoader)Unregister all commands from the classLoader instance.
-
-
-
Method Detail
-
registerCommand
void registerCommand(Command command)
Register a new command instance with all names that are is configured- Parameters:
command- the command that should registered
-
unregisterCommand
void unregisterCommand(java.lang.String command)
Unregister all commands from the map, that has the following string as name- Parameters:
command- the command name that should remove from the map
-
unregisterCommand
void unregisterCommand(java.lang.Class<? extends Command> command)
Unregister all commands from the map, that command instance class is like the argument- Parameters:
command- the class reference that should remove from the map
-
unregisterCommands
void unregisterCommands(java.lang.ClassLoader classLoader)
Unregister all commands from the classLoader instance.- Parameters:
classLoader- the classLoader from that all commands, that are contain will remove
-
unregisterCommands
void unregisterCommands()
Remove all commands from the command map
-
tabCompleteCommand
java.util.List<java.lang.String> tabCompleteCommand(java.lang.String commandLine)
Gets all tab complete results for the specific command line. If the line contains at least one space, it will get the command and then the tab complete results out of it. If the line doesn't contain any spaces, it will return the names of all registered commands that begin with thecommandLine(case-insensitive).- Parameters:
commandLine- the command with arguments to get the results from- Returns:
- a list containing all unsorted results
-
tabCompleteCommand
java.util.List<java.lang.String> tabCompleteCommand(java.lang.String[] args, de.dytanic.cloudnet.common.Properties properties)Gets all tab complete results for the specific command arguments and properties. If the length of the args is 0, it will return the names of all registered commands. If the length of the args is 1, but the given command doesn't exist, it will return the names of all registered commands that begin withargs[0](case-insensitive)- Parameters:
args- the command argumentsproperties- the properties for the tab completer- Returns:
- a list containing all unsorted results
-
getCommandInfos
java.util.Collection<de.dytanic.cloudnet.driver.command.CommandInfo> getCommandInfos()
Transform all commands instances that are contain in the map into a CommandInfo object
-
getCommandNames
java.util.Collection<java.lang.String> getCommandNames()
Returns all command names that are contain in the map
-
getCommand
Command getCommand(java.lang.String name)
Returns the command in the map with a specific name. If the name is more than one exist. The first command instance that could be found will return- Parameters:
name- the name, from that the command should resolve- Returns:
- first command instance that could be found
-
getCommandFromLine
Command getCommandFromLine(java.lang.String commandLine)
Returns the command object from the custom command line
-
dispatchCommand
boolean dispatchCommand(ICommandSender commandSender, java.lang.String commandLine)
Invokes a command execute() method when there is contain in the map and parsed from the command line the additional properties.- Parameters:
commandSender- the command sender of the commandLine that should usecommandLine- the following commandline that should dispatch- Returns:
- true if the command will successful executed or false when the command cannot be found in the map or an exception was thrown
-
registerCommand
default void registerCommand(Command... commands)
Register new command instances with all names that are is configured- Parameters:
commands- the commands that should registered
-
unregisterCommand
default void unregisterCommand(java.lang.String... commands)
Unregister all commands from the map, that has the following string as name- Parameters:
commands- the command names that should remove from the map
-
unregisterCommand
default void unregisterCommand(java.lang.Class<? extends Command>... commands)
Unregister all commands from the map, that command instance classes is like the argument- Parameters:
commands- the class references that should remove from the map
-
-