Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b8ff05f38 | |||
| cd039aeeaf | |||
| 70456455e3 | |||
| 1ae0f6083e |
@ -5,9 +5,9 @@ Allows you to communicate between your Minecraft servers with use of Redis and S
|
||||
|
||||
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!
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<groupId>net.limework</groupId>
|
||||
<version>1.3.6-SNAPSHOT</version>
|
||||
<version>1.3.7-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.SkriptLang</groupId>
|
||||
<artifactId>Skript</artifactId>
|
||||
<version>2.6.1</version>
|
||||
<version>2.10.1</version>
|
||||
<type>jar</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@ -67,7 +67,7 @@
|
||||
</exclusions>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -29,10 +29,7 @@ public class ExprChannel extends SimpleExpression<String> {
|
||||
|
||||
@Override
|
||||
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parseResult) {
|
||||
if (!ScriptLoader.isCurrentEvent(RedisMessageEvent.class)) {
|
||||
Skript.error("Cannot use 'redis channel' outside of a redis message event", ErrorQuality.SEMANTIC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -31,10 +31,7 @@ public class ExprMessage extends SimpleExpression<String> {
|
||||
|
||||
@Override
|
||||
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parseResult) {
|
||||
if (!ScriptLoader.isCurrentEvent(RedisMessageEvent.class)) {
|
||||
Skript.error("Cannot use 'redis message' outside of a redis message event", ErrorQuality.SEMANTIC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -32,10 +32,7 @@ public class ExprMessageDate extends SimpleExpression<Date> {
|
||||
|
||||
@Override
|
||||
public boolean init(final Expression<?>[] expressions, final int matchedPattern, final Kleenean isDelayed, final SkriptParser.ParseResult parseResult) {
|
||||
if (!ScriptLoader.isCurrentEvent(RedisMessageEvent.class)) {
|
||||
Skript.error("Cannot use 'redis message date' outside of a redis message event", ErrorQuality.SEMANTIC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<groupId>net.limework</groupId>
|
||||
<version>1.3.6-SNAPSHOT</version>
|
||||
<version>1.3.7-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
6
pom.xml
6
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.limework</groupId>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<version>1.3.6-SNAPSHOT</version>
|
||||
<version>1.3.7-SNAPSHOT</version>
|
||||
<modules>
|
||||
<module>RediSkript-core</module>
|
||||
<module>RediSkript-bukkit</module>
|
||||
@ -48,7 +48,7 @@
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>siv-mode</artifactId>
|
||||
<version>1.4.4</version>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
||||
<dependency>
|
||||
@ -59,7 +59,7 @@
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>4.2.2</version>
|
||||
<version>4.4.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user