Class EnumArgument<C,E extends Enum<E>>
java.lang.Object
cloud.commandframework.arguments.CommandArgument<C,E>
cloud.commandframework.arguments.standard.EnumArgument<C,E>
- Type Parameters:
C
- Argument senderE
- Enum type
- All Implemented Interfaces:
CloudKeyHolder<E>
,Comparable<CommandArgument<?,
?>>
Argument type that recognizes enums
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
EnumArgument.Builder<C,
E extends Enum<E>> static final class
static final class
EnumArgument.EnumParser<C,
E extends Enum<E>> Nested classes/interfaces inherited from class cloud.commandframework.arguments.CommandArgument
CommandArgument.TypedBuilder<C,
T, B extends CommandArgument.Builder<C, T>> -
Constructor Summary
ModifierConstructorDescriptionprotected
EnumArgument
(@NonNull Class<E> enumClass, boolean required, @NonNull String name, @NonNull String defaultValue, @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<@NonNull String>> suggestionsProvider, @NonNull ArgumentDescription defaultDescription) -
Method Summary
Modifier and TypeMethodDescriptionstatic <C,
E extends Enum<E>>
@NonNull EnumArgument.Builder<C,E> newBuilder
(@NonNull Class<E> enumClass, @NonNull String name) Create a new builderstatic <C,
E extends Enum<E>>
@NonNull CommandArgument<C,E> Create a new required command argumentstatic <C,
E extends Enum<E>>
@NonNull CommandArgument<C,E> Create a new optional command argumentstatic <C,
E extends Enum<E>>
@NonNull CommandArgument<C,E> Create a new optional command argument with a default valueMethods inherited from class cloud.commandframework.arguments.CommandArgument
addPreprocessor, compareTo, copy, equals, getDefaultDescription, getDefaultValue, getKey, getName, getOwningCommand, getParser, getSuggestionsProvider, getValueType, hasDefaultValue, hashCode, isArgumentRegistered, isRequired, ofType, ofType, preprocess, setArgumentRegistered, setOwningCommand, toString
-
Constructor Details
-
EnumArgument
protected EnumArgument(@NonNull Class<E> enumClass, boolean required, @NonNull String name, @NonNull String defaultValue, @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<@NonNull String>> suggestionsProvider, @NonNull ArgumentDescription defaultDescription)
-
-
Method Details
-
newBuilder
public static <C,E extends Enum<E>> @NonNull EnumArgument.Builder<C,E> newBuilder(@NonNull Class<E> enumClass, @NonNull String name) Create a new builder- Type Parameters:
C
- Command sender typeE
- Enum type- Parameters:
name
- Name of the argumentenumClass
- Enum class- Returns:
- Created builder
-
of
public static <C,E extends Enum<E>> @NonNull CommandArgument<C,E> of(@NonNull Class<E> enumClass, @NonNull String name) Create a new required command argument- Type Parameters:
C
- Command sender typeE
- Enum type- Parameters:
enumClass
- Enum classname
- Name of the argument- Returns:
- Created argument
-
optional
public static <C,E extends Enum<E>> @NonNull CommandArgument<C,E> optional(@NonNull Class<E> enumClass, @NonNull String name) Create a new optional command argument- Type Parameters:
C
- Command sender typeE
- Enum type- Parameters:
enumClass
- Enum classname
- Name of the argument- Returns:
- Created argument
-
optional
public static <C,E extends Enum<E>> @NonNull CommandArgument<C,E> optional(@NonNull Class<E> enumClass, @NonNull String name, @NonNull E defaultValue) Create a new optional command argument with a default value- Type Parameters:
C
- Command sender typeE
- Enum type- Parameters:
enumClass
- Enum classname
- Name of the argumentdefaultValue
- Default value- Returns:
- Created argument
-