Package top.focess.qq.api.command
Class CommandLine
- java.lang.Object
-
- top.focess.qq.api.command.CommandLine
-
public class CommandLine extends Object
The CommandLine Tool Class can be used to exec command with customize executor, arguments and receiver.
-
-
Constructor Summary
Constructors Constructor Description CommandLine()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Future<CommandResult>exec(String command)Execute command usingCommandSender.CONSOLEstatic Future<CommandResult>exec(CommandSender sender, String command)Execute command with senderstatic Future<CommandResult>exec(CommandSender sender, String command, IOHandler ioHandler)Execute command with sender executing and ioHandler receivingstatic voidregister(Plugin plugin, String name, SpecialArgumentHandler handler)Register the special argument handlerstatic List<String>splitCommand(String command)Split the command into argumentsstatic voidunregister(Plugin plugin)Unregister the special argument handlers by pluginstatic booleanunregisterAll()Unregister all the special argument handlers
-
-
-
Method Detail
-
exec
@NotNull public static Future<CommandResult> exec(String command)
Execute command usingCommandSender.CONSOLE- Parameters:
command- the command Console executes.- Returns:
- a Future representing pending completion of the command
-
exec
@NotNull public static Future<CommandResult> exec(CommandSender sender, String command)
Execute command with sender- Parameters:
sender- the executorcommand- the command CommandSender executes.- Returns:
- a Future representing pending completion of the command
-
exec
@NotNull public static Future<CommandResult> exec(CommandSender sender, String command, IOHandler ioHandler)
Execute command with sender executing and ioHandler receiving- Parameters:
sender- the executorcommand- the command CommandSender executes.ioHandler- the receiver- Returns:
- a Future representing pending completion of the command
-
splitCommand
public static List<String> splitCommand(String command)
Split the command into arguments- Parameters:
command- the command needed to be split- Returns:
- the split arguments
-
register
public static void register(Plugin plugin, String name, SpecialArgumentHandler handler)
Register the special argument handler- Parameters:
plugin- the pluginname- the name of the special argument handlerhandler- the special argument handler
-
unregister
public static void unregister(Plugin plugin)
Unregister the special argument handlers by plugin- Parameters:
plugin- the plugin
-
unregisterAll
public static boolean unregisterAll()
Unregister all the special argument handlers- Returns:
- true if there are some special argument handlers not belonging to MainPlugin not been unregistered, false otherwise
-
-