Class ArgumentNumber<T extends Number>
java.lang.Object
net.minestom.server.command.builder.arguments.Argument<T>
net.minestom.server.command.builder.arguments.number.ArgumentNumber<T>
- Direct Known Subclasses:
ArgumentDouble
,ArgumentFloat
,ArgumentInteger
,ArgumentLong
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Comparator
<T> protected boolean
protected boolean
protected T
protected T
static final int
protected final String
protected final BiConsumer
<BinaryWriter, T> protected final BiFunction
<String, Integer, T> static final int
static final int
Fields inherited from class net.minestom.server.command.builder.arguments.Argument
allowSpace, CONTAINER, suggestionType, useRemaining
-
Method Summary
Modifier and TypeMethodDescription@NotNull ArgumentNumber
<T> getMax()
Gets the maximum value for this argument.getMin()
Gets the minimum value for this argument.byte
Creates the byteflag based on the number's min/max existance.protected int
boolean
hasMax()
Gets if the argument has a maximum.boolean
hasMin()
Gets if the argument has a minimum.@NotNull ArgumentNumber
<T> @NotNull ArgumentNumber
<T> byte @Nullable []
parse
(@NotNull CommandSender sender, @NotNull String input) Parses the given input, and throw anArgumentSyntaxException
if the input cannot be converted toT
parser()
protected @NotNull String
parseValue
(@NotNull String value) protected @Nullable String
removeScientificNotation
(@NotNull String value) Methods inherited from class net.minestom.server.command.builder.arguments.Argument
allowSpace, equals, filter, getCallback, getDefaultValue, getId, getSuggestionCallback, hasErrorCallback, hashCode, hasSuggestion, isOptional, map, map, parse, setCallback, setDefaultValue, setDefaultValue, setDefaultValue, setSuggestionCallback, suggestionType, useRemaining
-
Field Details
-
NOT_NUMBER_ERROR
public static final int NOT_NUMBER_ERROR- See Also:
-
TOO_LOW_ERROR
public static final int TOO_LOW_ERROR- See Also:
-
TOO_HIGH_ERROR
public static final int TOO_HIGH_ERROR- See Also:
-
hasMin
protected boolean hasMin -
hasMax
protected boolean hasMax -
min
-
max
-
parserName
-
radixParser
-
parser
-
propertiesWriter
-
comparator
-
-
Method Details
-
parse
@NotNull public T parse(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String input) throws ArgumentSyntaxException Description copied from class:Argument
Parses the given input, and throw anArgumentSyntaxException
if the input cannot be converted toT
- Specified by:
parse
in classArgument<T extends Number>
- Parameters:
input
- the argument to parse- Returns:
- the parsed argument
- Throws:
ArgumentSyntaxException
- ifvalue
is not valid
-
parser
-
nodeProperties
public byte @Nullable [] nodeProperties()- Overrides:
nodeProperties
in classArgument<T extends Number>
-
min
-
max
-
between
-
getNumberProperties
public byte getNumberProperties()Creates the byteflag based on the number's min/max existance.- Returns:
- A byteflag for argument specification.
-
hasMin
public boolean hasMin()Gets if the argument has a minimum.- Returns:
- true if the argument has a minimum
-
getMin
Gets the minimum value for this argument.- Returns:
- the minimum of this argument
-
hasMax
public boolean hasMax()Gets if the argument has a maximum.- Returns:
- true if the argument has a maximum
-
getMax
Gets the maximum value for this argument.- Returns:
- the maximum of this argument
-
parseValue
-
getRadix
-
removeScientificNotation
-