Merge pull request #20 from creatorfromhell/patch-1

Fix async/sync issue.
This commit is contained in:
LlmDl authored and GitHub committed 2019-06-13 08:27:17 -05:00
commit 04de974e28
2 files changed
+4 -4

No files matched your search

@@ -122,7 +122,7 @@ public class StandardChannel extends Channel {
event.getRecipients().addAll(recipients); event.getRecipients().addAll(recipients);
if (isHooked()) { if (isHooked()) {
AsyncChatHookEvent hookEvent = new AsyncChatHookEvent(event, this); AsyncChatHookEvent hookEvent = new AsyncChatHookEvent(event, this, !Bukkit.getServer().isPrimaryThread());
Bukkit.getServer().getPluginManager().callEvent(hookEvent); Bukkit.getServer().getPluginManager().callEvent(hookEvent);
if (hookEvent.isCancelled()) { if (hookEvent.isCancelled()) {
event.setCancelled(true); event.setCancelled(true);
@@ -32,8 +32,8 @@ public class AsyncChatHookEvent extends Event {
protected boolean changed; protected boolean changed;
protected Channel channel; protected Channel channel;
public AsyncChatHookEvent(AsyncPlayerChatEvent event, Channel channel) { public AsyncChatHookEvent(AsyncPlayerChatEvent event, Channel channel, boolean async) {
super(true); super(async);
this.event = event; this.event = event;
this.changed = false; this.changed = false;
this.channel = channel; this.channel = channel;
@@ -110,4 +110,4 @@ public class AsyncChatHookEvent extends Event {
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }
} }