Module gomint.api

Class Command


  • public abstract class Command
    extends Object
    This class builds up a command. A command can have defined parameters and permissions

    Quick notes on the API design idea:

    Command cmd = new Command( "test" ); cmd.description("This is just a test command");

    Version:
    1.0
    Author:
    geNAZt
    • Constructor Detail

      • Command

        public Command()
        Constructor for loading commands from annotations like Name.
      • Command

        public Command​(String name)
        Construct a new command builder for a command name
        Parameters:
        name - The base name of the command
    • Method Detail

      • execute

        public abstract CommandOutput execute​(CommandSender commandSender,
                                              String alias,
                                              Map<String,​Object> arguments)
        Execute a command for a command sender
        Parameters:
        commandSender - which has executed the command
        alias - which the user used to execute this command
        arguments - which the player has given, optional parameters may be missing
        Returns:
        CommandOutput which has been generated by the execution
      • description

        public Command description​(String description)
        Set the description for this command
        Parameters:
        description - of the command
        Returns:
        the command currently build
      • permission

        public Command permission​(String permission)
        Set the permission a player needs to execute this command
        Parameters:
        permission - The permission which the player needs to execute
        Returns:
        the command currently build
      • alias

        public Command alias​(String alias)
        Add an alias to the command
        Parameters:
        alias - which should be added
        Returns:
        the command currently build
      • overload

        public CommandOverload overload()
        Add a version of this command. You can add multiple version of a command using this system. For example: - /list - /list
        Returns:
        overload storage for parameter definition