mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 22:21:52 +00:00
Merge pull request #20 from creatorfromhell/patch-1
Fix async/sync issue.
This commit is contained in:
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user