From ef71150db222ed8b5919c3dca257ebce6beed24b Mon Sep 17 00:00:00 2001 From: Govindas Date: Fri, 23 Oct 2020 16:55:04 +0300 Subject: [PATCH] Undo synchronous event, broke 1.8 servers completely --- src/main/java/net/limework/core/RediSkript.java | 7 ++++++- src/main/java/net/limework/core/managers/RedisManager.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/limework/core/RediSkript.java b/src/main/java/net/limework/core/RediSkript.java index cf33670..7c04f51 100644 --- a/src/main/java/net/limework/core/RediSkript.java +++ b/src/main/java/net/limework/core/RediSkript.java @@ -2,6 +2,7 @@ package net.limework.core; import net.limework.core.commands.ReloadRedis; import net.limework.core.hooks.SkriptHook; import net.limework.core.managers.RedisManager; +import org.bukkit.command.PluginCommand; import org.bukkit.plugin.java.JavaPlugin; public class RediSkript extends JavaPlugin { @@ -19,7 +20,11 @@ public class RediSkript extends JavaPlugin { saveDefaultConfig(); if (getServer().getPluginManager().getPlugin("Skript") != null) { startRedis(false); - getServer().getPluginCommand("reloadredis").setExecutor(new ReloadRedis(this)); + + PluginCommand command = getServer().getPluginCommand("reloadredis"); + assert command != null; + command.setExecutor(new ReloadRedis(this)); + new SkriptHook(this); } else { getLogger().info("Skript wasn't found."); diff --git a/src/main/java/net/limework/core/managers/RedisManager.java b/src/main/java/net/limework/core/managers/RedisManager.java index 17a5b6f..f6e3e2a 100644 --- a/src/main/java/net/limework/core/managers/RedisManager.java +++ b/src/main/java/net/limework/core/managers/RedisManager.java @@ -130,8 +130,8 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { JSONObject j = new JSONObject(receivedMessage); //System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString()); RedisMessageEvent event = new RedisMessageEvent(channelString, j.getString("Message"), j.getLong("Date")); - //Running it synchronously to ensure that the event is always synchronous - Bukkit.getScheduler().runTask(plugin, () -> plugin.getServer().getPluginManager().callEvent(event)); + + plugin.getServer().getPluginManager().callEvent(event); } } catch (Exception e) { e.printStackTrace();