1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-22 01:58:54 +00:00

修复一些奇怪的问题

1. 先取消时间,避免后续抛异常导致事件未被取消
2. AsyncPlayerChatEvent是异步的,在这个事件中的所有操作也是异步执行的,如果不切回同步线程,会导致抛“Entity async add”异常;并且在设置牌子的方法(setSignText)内,会有异步加载区块的风险,导致不可预知的后果
This commit is contained in:
17jiong 2018-01-29 00:20:04 +08:00
parent c193f2bc95
commit 1b519fe90f

View File

@ -23,7 +23,12 @@ public class ChatListener implements Listener {
if (!plugin.getShopManager().getActions().containsKey(e.getPlayer().getName())) {
return;
}
plugin.getShopManager().handleChat(e.getPlayer(), e.getMessage());
e.setCancelled(true);
e.setCancelled(true);
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
plugin.getShopManager().handleChat(e.getPlayer(), e.getMessage());
}
});
}
}