From 1a4d33879a6399dea08c0e4a91b6596e5e6a7b3c Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 16 Jun 2022 13:20:07 +0200 Subject: [PATCH 1/3] Extend broken parseJs method for "n > x" syntax More of an hack than anything Bug introduced in 423ae8977efeae2381c352a4def341a60050ce1b SD-9217 --- .../epicenchants/utils/single/GeneralUtils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/songoda/epicenchants/utils/single/GeneralUtils.java b/src/main/java/com/songoda/epicenchants/utils/single/GeneralUtils.java index 83998e2..696807b 100644 --- a/src/main/java/com/songoda/epicenchants/utils/single/GeneralUtils.java +++ b/src/main/java/com/songoda/epicenchants/utils/single/GeneralUtils.java @@ -99,6 +99,20 @@ public class GeneralUtils { } public static Object parseJS(String toParse, String type, Object def) { + if (toParse.trim().matches("^\\d+\\s+(<|>)\\s*\\d+$")) { // e.g. "1 < 2" + toParse = toParse.trim(); + + double firstNumber = Double.parseDouble(toParse.substring(0, toParse.indexOf(" "))); + String symbol = toParse.substring(toParse.indexOf(" ") + 1, toParse.indexOf(" ") + 2); + double secondNumber = Double.parseDouble(toParse.substring(toParse.indexOf(" ") + 2)); + + if (symbol.equals(">")) { + return firstNumber > secondNumber; + } + + return firstNumber < secondNumber; + } + // FIXME: JavaScript != Math... // Input "false ? (8 * 3) : (4 * 3)" fails for obvious reasons return MathUtils.eval(toParse, "[EpicEnchants] One of your " + type + " expressions is not properly formatted."); From 74740a54b0b399357f44db730f66a1f76b084d66 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 7 Jul 2022 19:14:41 +0200 Subject: [PATCH 2/3] Update SongodaCore to v2.6.13 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b9474fe..d871b72 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,7 @@ com.songoda SongodaCore - 2.6.12 + 2.6.13 compile From 3e7b2a6414d60f82fc8cacef43567cc10f3ee17b Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 7 Jul 2022 19:14:49 +0200 Subject: [PATCH 3/3] Release v1.2.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d871b72..d3d8b47 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.songoda EpicEnchants - 1.2.3 + 1.2.4 EpicEnchants Unlock the potential of your weapons, tools and armor by making your own custom enchants.