Annotation Interface Command


@Retention(RUNTIME) public @interface Command
This annotation indicates a command. Methods should be marked with this annotation to tell CommandsManager that the method is a command. Note that the method name can actually be anything.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    A list of aliases for the command.
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Get whether any flag can be used.
    Flags allow special processing for flags such as -h in the command, allowing users to easily turn on a flag.
     
    int
    The maximum number of arguments.
    int
    The minimum number of arguments.
    Usage instruction.
  • Element Details

    • aliases

      String[] aliases
      A list of aliases for the command. The first alias is the most important -- it is the main name of the command. (The method name is never used for anything).
      Returns:
      Aliases for a command
    • desc

      String desc
      Returns:
      A short description for the command.
    • usage

      String usage
      Usage instruction. Example text for usage could be [-h harps] [name] [message].
      Returns:
      Usage instructions for a command
      Default:
      ""
    • min

      int min
      The minimum number of arguments. This should be 0 or above.
      Returns:
      the minimum number of arguments
      Default:
      0
    • max

      int max
      The maximum number of arguments. Use -1 for an unlimited number of arguments.
      Returns:
      the maximum number of arguments
      Default:
      -1
    • flags

      String flags
      Flags allow special processing for flags such as -h in the command, allowing users to easily turn on a flag. This is a string with each character being a flag. Use A-Z and a-z as possible flags. Appending a flag with a : makes the flag character before a value flag, meaning that if it is given it must have a value
      Returns:
      Flags matching a-zA-Z
      Default:
      ""
    • help

      String help
      Returns:
      A long description for the command.
      Default:
      ""
    • anyFlags

      boolean anyFlags
      Get whether any flag can be used.
      Returns:
      true if so
      Default:
      false