Call PlayerIslandChatEvent async.

This commit is contained in:
Fernando Pettinelli 2021-07-18 01:43:42 -04:00
parent 7be512513d
commit ecbcc0324c

View File

@ -48,13 +48,7 @@ public class ChatListeners implements Listener {
PlayerIslandChatEvent islandChatEvent = new PlayerIslandChatEvent(player, island.getAPIWrapper(),
event.getMessage(), languageLoad.getString("Island.Chat.Format.Message"));
Runnable callEvent = () -> Bukkit.getServer().getPluginManager().callEvent(islandChatEvent);
if (Bukkit.isPrimaryThread()) {
callEvent.run();
} else {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, callEvent);
}
Bukkit.getServer().getPluginManager().callEvent(islandChatEvent);
}
}
}