From 9a5c674f0ddbd0d81578b43993c5c18c4dd1355c Mon Sep 17 00:00:00 2001 From: jmp Date: Mon, 26 Oct 2020 22:34:12 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20the=20correct=20default=20?= =?UTF-8?q?values=20for=20Double=20and=20Float=20ranges=20in=20the=20Stand?= =?UTF-8?q?ardParserRegistry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ .../arguments/parser/StandardParserRegistry.java | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05a04695..b24e1700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 parameter injectors - 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 diff --git a/cloud-core/src/main/java/cloud/commandframework/arguments/parser/StandardParserRegistry.java b/cloud-core/src/main/java/cloud/commandframework/arguments/parser/StandardParserRegistry.java index 75765a3f..917e3f69 100644 --- a/cloud-core/src/main/java/cloud/commandframework/arguments/parser/StandardParserRegistry.java +++ b/cloud-core/src/main/java/cloud/commandframework/arguments/parser/StandardParserRegistry.java @@ -113,13 +113,13 @@ public final class StandardParserRegistry implements ParserRegistry { )); this.registerParserSupplier(TypeToken.get(Float.class), options -> new FloatArgument.FloatParser<>( - (float) options.get(StandardParameters.RANGE_MIN, Float.MIN_VALUE), - (float) options.get(StandardParameters.RANGE_MAX, Float.MAX_VALUE) + (float) options.get(StandardParameters.RANGE_MIN, Float.NEGATIVE_INFINITY), + (float) options.get(StandardParameters.RANGE_MAX, Float.POSITIVE_INFINITY) )); this.registerParserSupplier(TypeToken.get(Double.class), options -> new DoubleArgument.DoubleParser<>( - (double) options.get(StandardParameters.RANGE_MIN, Double.MIN_VALUE), - (double) options.get(StandardParameters.RANGE_MAX, Double.MAX_VALUE) + (double) options.get(StandardParameters.RANGE_MIN, Double.NEGATIVE_INFINITY), + (double) options.get(StandardParameters.RANGE_MAX, Double.POSITIVE_INFINITY) )); this.registerParserSupplier(TypeToken.get(Character.class), options -> new CharArgument.CharacterParser<>()); this.registerParserSupplier(TypeToken.get(String[].class), options -> new StringArrayArgument.StringArrayParser<>());