Package de.dytanic.cloudnet.command
Class DefaultCommandMap
- java.lang.Object
-
- de.dytanic.cloudnet.command.DefaultCommandMap
-
- All Implemented Interfaces:
ICommandMap
public final class DefaultCommandMap extends java.lang.Object implements ICommandMap
-
-
Constructor Summary
Constructors Constructor Description DefaultCommandMap()
-
Method Summary
All Methods Instance Methods Concrete 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.booleandispatchCommand0(ICommandSender commandSender, java.lang.String commandLine)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 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 argumentvoidunregisterCommand(java.lang.String command)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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.dytanic.cloudnet.command.ICommandMap
registerCommand, unregisterCommand, unregisterCommand
-
-
-
-
Method Detail
-
registerCommand
public void registerCommand(Command command)
Description copied from interface:ICommandMapRegister a new command instance with all names that are is configured- Specified by:
registerCommandin interfaceICommandMap- Parameters:
command- the command that should registered
-
unregisterCommand
public void unregisterCommand(java.lang.String command)
Description copied from interface:ICommandMapUnregister all commands from the map, that has the following string as name- Specified by:
unregisterCommandin interfaceICommandMap- Parameters:
command- the command name that should remove from the map
-
unregisterCommand
public void unregisterCommand(java.lang.Class<? extends Command> command)
Description copied from interface:ICommandMapUnregister all commands from the map, that command instance class is like the argument- Specified by:
unregisterCommandin interfaceICommandMap- Parameters:
command- the class reference that should remove from the map
-
unregisterCommands
public void unregisterCommands(java.lang.ClassLoader classLoader)
Description copied from interface:ICommandMapUnregister all commands from the classLoader instance.- Specified by:
unregisterCommandsin interfaceICommandMap- Parameters:
classLoader- the classLoader from that all commands, that are contain will remove
-
unregisterCommands
public void unregisterCommands()
Description copied from interface:ICommandMapRemove all commands from the command map- Specified by:
unregisterCommandsin interfaceICommandMap
-
tabCompleteCommand
public java.util.List<java.lang.String> tabCompleteCommand(java.lang.String commandLine)
Description copied from interface:ICommandMapGets 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).- Specified by:
tabCompleteCommandin interfaceICommandMap- Parameters:
commandLine- the command with arguments to get the results from- Returns:
- a list containing all unsorted results
-
tabCompleteCommand
public java.util.List<java.lang.String> tabCompleteCommand(java.lang.String[] args, de.dytanic.cloudnet.common.Properties properties)Description copied from interface:ICommandMapGets 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)- Specified by:
tabCompleteCommandin interfaceICommandMap- Parameters:
args- the command argumentsproperties- the properties for the tab completer- Returns:
- a list containing all unsorted results
-
getCommandInfos
public java.util.Collection<de.dytanic.cloudnet.driver.command.CommandInfo> getCommandInfos()
Description copied from interface:ICommandMapTransform all commands instances that are contain in the map into a CommandInfo object- Specified by:
getCommandInfosin interfaceICommandMap
-
getCommand
public Command getCommand(java.lang.String name)
Description copied from interface:ICommandMapReturns 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- Specified by:
getCommandin interfaceICommandMap- Parameters:
name- the name, from that the command should resolve- Returns:
- first command instance that could be found
-
getCommandFromLine
public Command getCommandFromLine(java.lang.String commandLine)
Description copied from interface:ICommandMapReturns the command object from the custom command line- Specified by:
getCommandFromLinein interfaceICommandMap
-
getCommandNames
public java.util.Collection<java.lang.String> getCommandNames()
Description copied from interface:ICommandMapReturns all command names that are contain in the map- Specified by:
getCommandNamesin interfaceICommandMap
-
dispatchCommand
public boolean dispatchCommand(ICommandSender commandSender, java.lang.String commandLine)
Description copied from interface:ICommandMapInvokes a command execute() method when there is contain in the map and parsed from the command line the additional properties.- Specified by:
dispatchCommandin interfaceICommandMap- 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
-
dispatchCommand0
public boolean dispatchCommand0(ICommandSender commandSender, java.lang.String commandLine)
-
-