diff --git a/pom.xml b/pom.xml
index 47a2e5c..eeb4450 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
net.limework.rediskript
RediSkript
- 1.2.5
+ 1.3.0
jar
diff --git a/src/main/java/net/limework/rediskript/RediSkript.java b/src/main/java/net/limework/rediskript/RediSkript.java
index 55c8d9a..dc3eda5 100644
--- a/src/main/java/net/limework/rediskript/RediSkript.java
+++ b/src/main/java/net/limework/rediskript/RediSkript.java
@@ -1,15 +1,13 @@
package net.limework.rediskript;
+
import net.limework.rediskript.commands.CommandReloadRedis;
-import net.limework.rediskript.skript.SkriptHook;
import net.limework.rediskript.managers.RedisManager;
-import org.bukkit.Bukkit;
+import net.limework.rediskript.skript.SkriptHook;
import org.bukkit.command.PluginCommand;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.plugin.java.JavaPlugin;
-import java.util.concurrent.TimeUnit;
-
public class RediSkript extends JavaPlugin {
//Redis manager
diff --git a/src/main/java/net/limework/rediskript/managers/RedisManager.java b/src/main/java/net/limework/rediskript/managers/RedisManager.java
index b637e84..acd43d3 100644
--- a/src/main/java/net/limework/rediskript/managers/RedisManager.java
+++ b/src/main/java/net/limework/rediskript/managers/RedisManager.java
@@ -174,41 +174,21 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
}
String[] inputs = changeValue.split("\\^", 2);
inputValue = Classes.deserialize(inputs[0], Base64.getDecoder().decode(inputs[1]));
-
- //operations ARE UNFINISHED. because I do not yet know how to handle all the Long/Double conversions without issues.
-
- //first check if the variable is set
-
- if (Variables.getVariable(variableNames.get(i).toString(), null, false) != null) {
-
- //add to variable
-
- if (j.getString("Operation").equals("ADD")) {
- if (inputValue.getClass().getName().equals("java.lang.Long")) {
- inputValue = (Long) inputValue + (Long) Variables.getVariable(variableNames.get(i).toString(), null, false);
- } else if (inputValue.getClass().getName().equals("java.lang.Double")) {
- inputValue = (Double) inputValue + (Double) Variables.getVariable(variableNames.get(i).toString(), null, false);
- }
-
- //remove from variable
-
- } else if (j.getString("Operation").equals("REMOVE")) {
-
- if (inputValue.getClass().getName().equals("java.lang.Long")) {
- inputValue = (Long) Variables.getVariable(variableNames.get(i).toString(), null, false) - (Long) inputValue;
- } else if (inputValue.getClass().getName().equals("java.lang.Double")) {
- inputValue = (Double) Variables.getVariable(variableNames.get(i).toString(), null, false) - (Double) inputValue;
- }
- }
- //if variable isn't set and removing, we ned it to properly convert this
- } else if (j.getString("Operation").equals("REMOVE")) {
- if (inputValue.getClass().getName().equals("java.lang.Long")) {
- inputValue = -(Long) inputValue;
- } else if (inputValue.getClass().getName().equals("java.lang.Double")) {
- inputValue = -(Double) inputValue;
- }
+ switch (j.getString("Operation")) {
+ case "ADD":
+ //I will add this once someone tells me how to remove from Skript variable
+ //because using SET operation has issues with inconvertible types (Double and Long)
+ //variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
+ // variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
+ case "REMOVE":
+ //I will add this once someone tells me how to remove from Skript variable
+ //because using SET operation has issues with inconvertible types (Double and Long)
+ //variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
+ // variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
+ break;
+ case "SET":
+ Variables.setVariable(variableNames.get(i).toString(), inputValue, null, false);
}
- Variables.setVariable(variableNames.get(i).toString(), inputValue, null, false);
}
}
}
diff --git a/src/main/java/net/limework/rediskript/skript/SkriptHook.java b/src/main/java/net/limework/rediskript/skript/SkriptHook.java
index abb4bda..a302588 100644
--- a/src/main/java/net/limework/rediskript/skript/SkriptHook.java
+++ b/src/main/java/net/limework/rediskript/skript/SkriptHook.java
@@ -19,7 +19,7 @@ public class SkriptHook {
try {
addon.loadClasses("net.limework.rediskript.skript", "elements");
Skript.registerEvent("redis message", EvtRedis.class, RedisMessageEvent.class, "redis message");
- Skript.registerExpression(ExprVariableInChannel.class, Object.class, ExpressionType.PROPERTY, "variable[s] %strings% in [redis] channel %string%");
+ Skript.registerExpression(ExprVariableInChannel.class, Object.class, ExpressionType.PROPERTY, "variable[s] %strings% in [redis] [channel] %string%");
Skript.registerExpression(ExprChannel.class, String.class, ExpressionType.SIMPLE, "redis channel");
EventValues.registerEventValue(RedisMessageEvent.class, String.class, new Getter() {
diff --git a/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java b/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java
index 45a3968..fc3b318 100644
--- a/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java
+++ b/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java
@@ -6,16 +6,9 @@ import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import net.limework.rediskript.RediSkript;
-import net.limework.rediskript.managers.RedisManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.Event;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import redis.clients.jedis.BinaryJedis;
-import redis.clients.jedis.exceptions.JedisConnectionException;
-
-import java.nio.charset.StandardCharsets;
public class EffSendMessage extends Effect {
static {
diff --git a/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java b/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java
index 071a70d..a68b0d8 100644
--- a/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java
+++ b/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java
@@ -3,7 +3,6 @@ package net.limework.rediskript.skript.elements;
import ch.njol.skript.classes.Changer;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
-import ch.njol.skript.lang.Variable;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.skript.registrations.Classes;
import ch.njol.skript.variables.SerializedVariable;
@@ -20,13 +19,13 @@ public class ExprVariableInChannel extends SimpleExpression