Class DurationArgument<C>
java.lang.Object
cloud.commandframework.arguments.CommandArgument<C,Duration>
cloud.commandframework.arguments.standard.DurationArgument<C>
- Type Parameters:
C- sender type
- All Implemented Interfaces:
CloudKeyHolder<Duration>,Comparable<CommandArgument<?,?>>
@API(status=STABLE,
since="1.7.0")
public final class DurationArgument<C>
extends CommandArgument<C,Duration>
Parses
Duration from a 1d2h3m4s format.- Since:
- 1.7.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder forDurationArgument.static final classFailure exception forDurationArgument.Parser.static final classParser forDuration.Nested classes/interfaces inherited from class cloud.commandframework.arguments.CommandArgument
CommandArgument.TypedBuilder<C,T, B extends CommandArgument.Builder<C, T>> -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> @NonNull DurationArgument.Builder<C>Create a newDurationArgument.Builder.static <C> @NonNull DurationArgument<C>Create a new requiredDurationArgument.static <C> @NonNull DurationArgument<C>Create a new optionalDurationArgument.static <C> @NonNull DurationArgument<C>Create a new optionalDurationArgumentwith the specified default value.static <C> @NonNull DurationArgument<C>Create a new optionalDurationArgumentwith the specified default value.Methods 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
-
Method Details
-
builder
Create a newDurationArgument.Builder.- Type Parameters:
C- sender type- Parameters:
name- argument name- Returns:
- new builder
- Since:
- 1.7.0
-
of
Create a new requiredDurationArgument.- Type Parameters:
C- sender type- Parameters:
name- argument name- Returns:
- built argument
- Since:
- 1.7.0
-
optional
Create a new optionalDurationArgument.- Type Parameters:
C- sender type- Parameters:
name- argument name- Returns:
- built argument
- Since:
- 1.7.0
-
optional
public static <C> @NonNull DurationArgument<C> optional(@NonNull String name, @NonNull String defaultDuration) Create a new optionalDurationArgumentwith the specified default value.- Type Parameters:
C- sender type- Parameters:
name- argument namedefaultDuration- default duration- Returns:
- built argument
- Since:
- 1.7.0
-
optional
public static <C> @NonNull DurationArgument<C> optional(@NonNull String name, @NonNull Duration defaultDuration) Create a new optionalDurationArgumentwith the specified default value.- Type Parameters:
C- sender type- Parameters:
name- argument namedefaultDuration- default duration- Returns:
- built argument
- Since:
- 1.7.0
-