forked from Limework/RediSkript
Make on redis message a synchronous event for thread-safety
This commit is contained in:
parent
0c20becfa1
commit
f80d9b36e7
@ -12,7 +12,7 @@ public class RedisMessageEvent extends Event {
|
||||
private long date;
|
||||
|
||||
public RedisMessageEvent(String channelName , String message, long date) {
|
||||
super(true);
|
||||
super(false);
|
||||
this.channelName = channelName;
|
||||
this.message = message;
|
||||
this.date = date;
|
||||
|
@ -130,8 +130,7 @@ 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"));
|
||||
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
Bukkit.getScheduler().runTask(plugin, () -> plugin.getServer().getPluginManager().callEvent(event));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user