Fix Integer & Update deps

This commit is contained in:
Linux User 2024-01-21 19:26:56 +02:00
parent 70456455e3
commit cd039aeeaf
4 changed files with 44 additions and 5 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<version>1.3.6-SNAPSHOT</version> <version>1.3.7-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -179,8 +179,12 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
if (variable == null) { if (variable == null) {
Variables.setVariable(varName, inputValue, null, false); Variables.setVariable(varName, inputValue, null, false);
} else if (variable instanceof Long) { } else if (variable instanceof Long) {
if (inputValue instanceof Integer) {
inputValue = Long.valueOf((Integer) inputValue);
}
if (inputValue instanceof Long) { if (inputValue instanceof Long) {
Variables.setVariable(varName, (Long) variable + (Long) inputValue, null, false); Variables.setVariable(varName, (Long) variable + (Long) inputValue, null, false);
} else if (inputValue instanceof Double) { } else if (inputValue instanceof Double) {
// convert Long variable to Double // convert Long variable to Double
@ -192,6 +196,9 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
continue; continue;
} }
} else if (variable instanceof Double) { } else if (variable instanceof Double) {
if (inputValue instanceof Integer) {
inputValue = Double.valueOf((Integer) inputValue);
}
if (inputValue instanceof Double) { if (inputValue instanceof Double) {
Variables.setVariable(varName, (Double) variable + (Double) inputValue, null, false); Variables.setVariable(varName, (Double) variable + (Double) inputValue, null, false);
} else if (inputValue instanceof Long) { } 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); plugin.getLogger().log(Level.WARNING, "Unsupported add action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName);
continue; 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 { } else {
// Not supported input type // Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported variable type in add action (" + variable.getClass().getName() + ") on variable: " + varName); 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); Variables.setVariable(varName, -(Long) inputValue, null, false);
} else if (inputValue instanceof Double) { } else if (inputValue instanceof Double) {
Variables.setVariable(varName, -(Double) inputValue, null, false); Variables.setVariable(varName, -(Double) inputValue, null, false);
} else if (inputValue instanceof Integer) {
Variables.setVariable(varName, -(Integer) inputValue, null, false);
} else { } else {
// Not supported input type // Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported remove action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName); plugin.getLogger().log(Level.WARNING, "Unsupported remove action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName);
continue; continue;
} }
} else if (variable instanceof Long) { } else if (variable instanceof Long) {
if (inputValue instanceof Integer) {
inputValue = Long.valueOf((Integer) inputValue);
}
if (inputValue instanceof Long) { if (inputValue instanceof Long) {
Variables.setVariable(varName, (Long) variable - (Long) inputValue, null, false); Variables.setVariable(varName, (Long) variable - (Long) inputValue, null, false);
} else if (inputValue instanceof Double) { } else if (inputValue instanceof Double) {
@ -237,11 +261,26 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
continue; continue;
} }
} else if (variable instanceof Double) { } else if (variable instanceof Double) {
if (inputValue instanceof Integer) {
inputValue = Double.valueOf((Integer) inputValue);
}
if (inputValue instanceof Double) { if (inputValue instanceof Double) {
Variables.setVariable(varName, (Double) variable - (Double) inputValue, null, false); Variables.setVariable(varName, (Double) variable - (Double) inputValue, null, false);
} else if (inputValue instanceof Long) { } else if (inputValue instanceof Long) {
Variables.setVariable(varName, (Double) variable - ((Long) inputValue).doubleValue(), null, false); 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 { } else {
// Not supported input type // Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported variable type in remove action (" + variable.getClass().getName() + ") on variable: " + varName); plugin.getLogger().log(Level.WARNING, "Unsupported variable type in remove action (" + variable.getClass().getName() + ") on variable: " + varName);

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<version>1.3.6-SNAPSHOT</version> <version>1.3.7-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<version>1.3.6-SNAPSHOT</version> <version>1.3.7-SNAPSHOT</version>
<modules> <modules>
<module>RediSkript-core</module> <module>RediSkript-core</module>
<module>RediSkript-bukkit</module> <module>RediSkript-bukkit</module>
@ -48,7 +48,7 @@
<dependency> <dependency>
<groupId>org.cryptomator</groupId> <groupId>org.cryptomator</groupId>
<artifactId>siv-mode</artifactId> <artifactId>siv-mode</artifactId>
<version>1.4.4</version> <version>1.5.0</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 --> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
<dependency> <dependency>
@ -59,7 +59,7 @@
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>4.2.2</version> <version>4.4.6</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>