forked from Limework/RediSkript
		
	Undo synchronous event, broke 1.8 servers completely
This commit is contained in:
		
							parent
							
								
									776ebc9780
								
							
						
					
					
						commit
						31db51fce6
					
				| @ -2,6 +2,7 @@ package net.limework.core; | |||||||
| import net.limework.core.commands.ReloadRedis; | import net.limework.core.commands.ReloadRedis; | ||||||
| import net.limework.core.hooks.SkriptHook; | import net.limework.core.hooks.SkriptHook; | ||||||
| import net.limework.core.managers.RedisManager; | import net.limework.core.managers.RedisManager; | ||||||
|  | import org.bukkit.command.PluginCommand; | ||||||
| import org.bukkit.plugin.java.JavaPlugin; | import org.bukkit.plugin.java.JavaPlugin; | ||||||
| 
 | 
 | ||||||
| public class RediSkript extends JavaPlugin { | public class RediSkript extends JavaPlugin { | ||||||
| @ -19,7 +20,11 @@ public class RediSkript extends JavaPlugin { | |||||||
|         saveDefaultConfig(); |         saveDefaultConfig(); | ||||||
|         if (getServer().getPluginManager().getPlugin("Skript") != null) { |         if (getServer().getPluginManager().getPlugin("Skript") != null) { | ||||||
|             startRedis(false); |             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); |             new SkriptHook(this); | ||||||
|         } else { |         } else { | ||||||
|             getLogger().info("Skript wasn't found."); |             getLogger().info("Skript wasn't found."); | ||||||
|  | |||||||
| @ -130,8 +130,8 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { | |||||||
|                 JSONObject j = new JSONObject(receivedMessage); |                 JSONObject j = new JSONObject(receivedMessage); | ||||||
|                 //System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString()); |                 //System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString()); | ||||||
|                 RedisMessageEvent event = new RedisMessageEvent(channelString, j.getString("Message"), j.getLong("Date")); |                 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) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Govindass
						Govindass