Class CommandFlag<T>

java.lang.Object
cloud.commandframework.arguments.flags.CommandFlag<T>
Type Parameters:
T - Command argument type. Void is used when no argument is present.

@API(status=STABLE) public final class CommandFlag<T> extends Object
A flag is an optional command argument that may have an associated parser, and is identified by its name. Essentially, it's a mixture of a command literal and an optional variable command argument.
  • Method Details

    • newBuilder

      public static @NonNull CommandFlag.Builder<Void> newBuilder(@NonNull String name)
      Create a new flag builder
      Parameters:
      name - Flag name
      Returns:
      Flag builder
    • getName

      public @NonNull String getName()
      Get the flag name
      Returns:
      Flag name
    • getAliases

      public @NonNull Collection<@NonNull String> getAliases()
      Get all flag aliases. This does not include the flag name
      Returns:
      Flag aliases
    • mode

      @API(status=STABLE, since="1.7.0") public @NonNull CommandFlag.FlagMode mode()
      Returns the mode of this flag.
      Returns:
      the flag mode
    • getDescription

      @Deprecated @API(status=DEPRECATED, since="1.4.0") public @NonNull Description getDescription()
      Deprecated.
      for removal since 1.4.0. Use getArgumentDescription() instead.
      Get the flag description
      Returns:
      Flag description
    • getArgumentDescription

      @API(status=STABLE, since="1.4.0") public @NonNull ArgumentDescription getArgumentDescription()
      Get the flag description.
      Returns:
      Flag description
      Since:
      1.4.0
    • getCommandArgument

      public @Nullable CommandArgument<?,T> getCommandArgument()
      Get the command argument, if it exists
      Returns:
      Command argument, or null
    • permission

      @API(status=STABLE, since="1.6.0") public CommandPermission permission()
      Get the permission required to use this flag, if it exists
      Returns:
      Command permission, or null
      Since:
      1.6.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object