🐛 Use the correct default values for Double and Float ranges in the StandardParserRegistry

This commit is contained in:
jmp 2020-10-26 22:34:12 -07:00 committed by Alexander Söderberg
parent 118005978f
commit 9a5c674f0d
2 changed files with 7 additions and 4 deletions

View file

@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added access to the CloudBrigadierManager from Brigadier-enabled command managers - Added access to the CloudBrigadierManager from Brigadier-enabled command managers
- Added parameter injectors - Added parameter injectors
- Store currently parsing command argument in the command context - Store currently parsing command argument in the command context
### Fixed
- Use the correct default range for Double and Float parsers in the StandardParserRegistry
## [1.1.0] - 2020-10-24 ## [1.1.0] - 2020-10-24

View file

@ -113,13 +113,13 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
)); ));
this.registerParserSupplier(TypeToken.get(Float.class), options -> this.registerParserSupplier(TypeToken.get(Float.class), options ->
new FloatArgument.FloatParser<>( new FloatArgument.FloatParser<>(
(float) options.get(StandardParameters.RANGE_MIN, Float.MIN_VALUE), (float) options.get(StandardParameters.RANGE_MIN, Float.NEGATIVE_INFINITY),
(float) options.get(StandardParameters.RANGE_MAX, Float.MAX_VALUE) (float) options.get(StandardParameters.RANGE_MAX, Float.POSITIVE_INFINITY)
)); ));
this.registerParserSupplier(TypeToken.get(Double.class), options -> this.registerParserSupplier(TypeToken.get(Double.class), options ->
new DoubleArgument.DoubleParser<>( new DoubleArgument.DoubleParser<>(
(double) options.get(StandardParameters.RANGE_MIN, Double.MIN_VALUE), (double) options.get(StandardParameters.RANGE_MIN, Double.NEGATIVE_INFINITY),
(double) options.get(StandardParameters.RANGE_MAX, Double.MAX_VALUE) (double) options.get(StandardParameters.RANGE_MAX, Double.POSITIVE_INFINITY)
)); ));
this.registerParserSupplier(TypeToken.get(Character.class), options -> new CharArgument.CharacterParser<>()); this.registerParserSupplier(TypeToken.get(Character.class), options -> new CharArgument.CharacterParser<>());
this.registerParserSupplier(TypeToken.get(String[].class), options -> new StringArrayArgument.StringArrayParser<>()); this.registerParserSupplier(TypeToken.get(String[].class), options -> new StringArrayArgument.StringArrayParser<>());