Compare commits

...

3 Commits

5 changed files with 46 additions and 7 deletions

View File

@ -5,9 +5,9 @@ Allows you to communicate between your Minecraft servers with use of Redis and S
Skript: https://github.com/SkriptLang/Skript Skript: https://github.com/SkriptLang/Skript
RediSkript spigot page: https://www.spigotmc.org/resources/rediskript-communicate-between-servers-with-ease.85067/ RediSkript spigot page: https://www.spigotmc.org/resources/rediskript-communicate-between-servers-with-ease.85067/s
Jedis: https://github.com/redis/jedis Minecraft server version supported: **1.8.8+** (On 1.8, may need to use a fork of Skript)
You can transfer any data in the form of text between your servers, you can program it to execute a set of instructions on the server depending on the redis message, etc. This can be used for making scripts that sync data between all servers and much more! You can transfer any data in the form of text between your servers, you can program it to execute a set of instructions on the server depending on the redis message, etc. This can be used for making scripts that sync data between all servers and much more!

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>