Class CommandLine


  • public class CommandLine
    extends Object
    The CommandLine Tool Class can be used to exec command with customize executor, arguments and receiver.
    • Constructor Detail

      • CommandLine

        public CommandLine()
    • Method Detail

      • exec

        @NotNull
        public static Future<CommandResult> exec​(String command)
        Execute command using CommandSender.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 executor
        command - 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 executor
        command - 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 plugin
        name - the name of the special argument handler
        handler - 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