Undo synchronous event, broke 1.8 servers completely

This commit is contained in:
Govindass 2020-10-23 16:55:04 +03:00
parent 776ebc9780
commit 31db51fce6
2 changed files with 8 additions and 3 deletions

View File

@ -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.");

View File

@ -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();