Annotation Type Flag


@Target(PARAMETER) @Retention(RUNTIME) public @interface Flag
Indicates that the parameter should be treated like a CommandFlag.
  • If the parameter is a boolean, a presence flag will be created
  • If the parameter is of any other type, a value flag will be created and the parser will resolve it in the same way that it would for an Argument
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    @NonNull String
    The flag name
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    @NonNull String[]
    Flag aliases
    @NonNull String
    The argument description
    @NonNull String
    Name of the parser.
    @NonNull String
    The flag permission
    boolean
    Whether the flag can be repeated.
    @NonNull String
    Name of the suggestions provider to use.
  • Element Details

    • value

      @NonNull String value
      The flag name
      Returns:
      Flag name
    • aliases

      @NonNull String[] aliases
      Flag aliases
      Returns:
      Aliases
      Default:
      {""}
    • parserName

      @NonNull String parserName
      Name of the parser. Leave empty to use the default parser for the parameter type
      Returns:
      Parser name
      Default:
      ""
    • suggestions

      @NonNull String suggestions
      Name of the suggestions provider to use. If the string is left empty, the default provider for the argument parser will be used. Otherwise, the ParserRegistry instance in the CommandManager will be queried for a matching suggestion provider.

      For this to work, the suggestion needs to be registered in the parser registry. To do this, use ParserRegistry.registerSuggestionProvider(String, BiFunction). The registry instance can be retrieved using CommandManager.parserRegistry().

      Returns:
      The name of the suggestion provider, or "" if the default suggestion provider for the argument parser should be used instead
      Since:
      1.2.0
      Default:
      ""
    • description

      @NonNull String description
      The argument description
      Returns:
      Argument description
      Default:
      ""
    • permission

      @NonNull String permission
      The flag permission
      Returns:
      Flag permission
      Since:
      1.6.0
      Default:
      ""
    • repeatable

      @API(status=STABLE, since="1.7.0") boolean repeatable
      Whether the flag can be repeated.
      Returns:
      whether the flag can be repeated
      Since:
      1.7.0
      Default:
      false