From 57664379caea94e41ce2adeef772d7e3d1007757 Mon Sep 17 00:00:00 2001 From: isXander Date: Sat, 17 Jun 2023 09:21:03 +0100 Subject: Fix IntegerFieldController and LongFieldController not allowing negative numbers. --- .../yacl3/gui/controllers/string/number/IntegerFieldController.java | 2 +- .../yacl3/gui/controllers/string/number/LongFieldController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/IntegerFieldController.java b/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/IntegerFieldController.java index 5c15a2e..445e984 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/IntegerFieldController.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/IntegerFieldController.java @@ -64,7 +64,7 @@ public class IntegerFieldController extends NumberFieldController { @Override public boolean isInputValid(String input) { - return input.matches("\\d+|-|"); + return input.matches("(?:-?\\d+|)"); } /** diff --git a/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/LongFieldController.java b/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/LongFieldController.java index b36b0f3..fe2ef2c 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/LongFieldController.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/controllers/string/number/LongFieldController.java @@ -64,7 +64,7 @@ public class LongFieldController extends NumberFieldController { @Override public boolean isInputValid(String input) { - return input.matches("\\d+|-|"); + return input.matches("(?:-?\\d+|)"); } /** -- cgit