From cd039aeeafba1e496edfc3e7ce47346c07a33d95 Mon Sep 17 00:00:00 2001 From: Linux User Date: Sun, 21 Jan 2024 19:26:56 +0200 Subject: [PATCH] Fix Integer & Update deps --- RediSkript-bukkit/pom.xml | 2 +- .../rediskript/managers/RedisController.java | 39 +++++++++++++++++++ RediSkript-core/pom.xml | 2 +- pom.xml | 6 +-- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/RediSkript-bukkit/pom.xml b/RediSkript-bukkit/pom.xml index 493d115..d424efa 100644 --- a/RediSkript-bukkit/pom.xml +++ b/RediSkript-bukkit/pom.xml @@ -5,7 +5,7 @@ RediSkript net.limework - 1.3.6-SNAPSHOT + 1.3.7-SNAPSHOT 4.0.0 diff --git a/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java index f5e1294..63d1e1e 100644 --- a/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java +++ b/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java @@ -179,8 +179,12 @@ public class RedisController extends BinaryJedisPubSub implements Runnable { if (variable == null) { Variables.setVariable(varName, inputValue, null, false); } else if (variable instanceof Long) { + if (inputValue instanceof Integer) { + inputValue = Long.valueOf((Integer) inputValue); + } if (inputValue instanceof Long) { Variables.setVariable(varName, (Long) variable + (Long) inputValue, null, false); + } else if (inputValue instanceof Double) { // convert Long variable to Double @@ -192,6 +196,9 @@ public class RedisController extends BinaryJedisPubSub implements Runnable { continue; } } else if (variable instanceof Double) { + if (inputValue instanceof Integer) { + inputValue = Double.valueOf((Integer) inputValue); + } if (inputValue instanceof Double) { Variables.setVariable(varName, (Double) variable + (Double) inputValue, null, false); } else if (inputValue instanceof Long) { @@ -201,6 +208,18 @@ public class RedisController extends BinaryJedisPubSub implements Runnable { plugin.getLogger().log(Level.WARNING, "Unsupported add action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName); continue; } + } else if (variable instanceof Integer) { + if (inputValue instanceof Integer) { + Variables.setVariable(varName, (Integer) variable + (Integer) inputValue, null, false); + } else if (inputValue instanceof Double) { + // convert Integer variable to Double + variable = Double.valueOf((Integer) variable); + Variables.setVariable(varName, (Double) variable + (Double) inputValue, null, false); + } else if (inputValue instanceof Long) { + // convert Integer variable to Long + variable = Long.valueOf((Integer) variable); + Variables.setVariable(varName, (Long) variable + (Long) inputValue, null, false); + } } else { // Not supported input type plugin.getLogger().log(Level.WARNING, "Unsupported variable type in add action (" + variable.getClass().getName() + ") on variable: " + varName); @@ -218,12 +237,17 @@ public class RedisController extends BinaryJedisPubSub implements Runnable { Variables.setVariable(varName, -(Long) inputValue, null, false); } else if (inputValue instanceof Double) { Variables.setVariable(varName, -(Double) inputValue, null, false); + } else if (inputValue instanceof Integer) { + Variables.setVariable(varName, -(Integer) inputValue, null, false); } else { // Not supported input type plugin.getLogger().log(Level.WARNING, "Unsupported remove action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName); continue; } } else if (variable instanceof Long) { + if (inputValue instanceof Integer) { + inputValue = Long.valueOf((Integer) inputValue); + } if (inputValue instanceof Long) { Variables.setVariable(varName, (Long) variable - (Long) inputValue, null, false); } else if (inputValue instanceof Double) { @@ -237,11 +261,26 @@ public class RedisController extends BinaryJedisPubSub implements Runnable { continue; } } else if (variable instanceof Double) { + if (inputValue instanceof Integer) { + inputValue = Double.valueOf((Integer) inputValue); + } if (inputValue instanceof Double) { Variables.setVariable(varName, (Double) variable - (Double) inputValue, null, false); } else if (inputValue instanceof Long) { Variables.setVariable(varName, (Double) variable - ((Long) inputValue).doubleValue(), null, false); } + } else if (variable instanceof Integer) { + if (inputValue instanceof Integer) { + Variables.setVariable(varName, (Integer) variable - (Integer) inputValue, null, false); + } else if (inputValue instanceof Long) { + // convert Integer variable to Long + variable = Long.valueOf((Integer) variable); + Variables.setVariable(varName, (Long) variable - (Long) inputValue, null, false); + } else if (inputValue instanceof Double) { + // convert Integer variable to Double + variable = Double.valueOf((Integer) variable); + Variables.setVariable(varName, (Double) variable - (Double) inputValue, null, false); + } } else { // Not supported input type plugin.getLogger().log(Level.WARNING, "Unsupported variable type in remove action (" + variable.getClass().getName() + ") on variable: " + varName); diff --git a/RediSkript-core/pom.xml b/RediSkript-core/pom.xml index e2e151b..cbbc89a 100644 --- a/RediSkript-core/pom.xml +++ b/RediSkript-core/pom.xml @@ -5,7 +5,7 @@ RediSkript net.limework - 1.3.6-SNAPSHOT + 1.3.7-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index e838ff6..ecd5e49 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.limework RediSkript - 1.3.6-SNAPSHOT + 1.3.7-SNAPSHOT RediSkript-core RediSkript-bukkit @@ -48,7 +48,7 @@ org.cryptomator siv-mode - 1.4.4 + 1.5.0 @@ -59,7 +59,7 @@ redis.clients jedis - 4.2.2 + 4.4.6