Interface ICommandMap

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      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.
      Command getCommand​(java.lang.String name)
      Returns the command in the map with a specific name.
      Command getCommandFromLine​(java.lang.String commandLine)
      Returns the command object from the custom command line
      java.util.Collection<de.dytanic.cloudnet.driver.command.CommandInfo> getCommandInfos()
      Transform all commands instances that are contain in the map into a CommandInfo object
      java.util.Collection<java.lang.String> getCommandNames()
      Returns all command names that are contain in the map
      void registerCommand​(Command command)
      Register a new command instance with all names that are is configured
      default void registerCommand​(Command... commands)
      Register new command instances with all names that are is configured
      java.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.
      void unregisterCommand​(java.lang.Class<? extends Command> command)
      Unregister all commands from the map, that command instance class is like the argument
      default void unregisterCommand​(java.lang.Class<? extends Command>... commands)
      Unregister all commands from the map, that command instance classes is like the argument
      void unregisterCommand​(java.lang.String command)
      Unregister all commands from the map, that has the following string as name
      default void unregisterCommand​(java.lang.String... commands)
      Unregister all commands from the map, that has the following string as name
      void unregisterCommands()
      Remove all commands from the command map
      void unregisterCommands​(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 the commandLine (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 with args[0] (case-insensitive)
        Parameters:
        args - the command arguments
        properties - 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 use
        commandLine - 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