diff --git a/pom.xml b/pom.xml index 0073a64..69406ef 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 pw.yumc Yum - 2.3 + 2.4 Yum Minecraft 服务器插件管理系统 @@ -60,6 +60,7 @@ &a全新 2.X 版本 更多守护与优化 + &b2.4 &6- &c修复重载插件导致线程安全错误的问题...; &b2.3 &6- &a网络监控添加域名白名单功能...; &b2.2 &6- &b新增线程安全拦截 主线程IO拦截...; &b2.1 &6- &e新增网络管理 防止主线程卡IO...; diff --git a/src/main/java/pw/yumc/Yum/Yum.java b/src/main/java/pw/yumc/Yum/Yum.java index 14a0c84..84f1cce 100644 --- a/src/main/java/pw/yumc/Yum/Yum.java +++ b/src/main/java/pw/yumc/Yum/Yum.java @@ -92,7 +92,7 @@ public class Yum extends JavaPlugin { new PluginNetworkListener(this); PluginKit.scp("§a网络管理系统已启用..."); } - if (ConfigManager.i().isThreadSafe()) { + if (ConfigManager.i().isThreadSafe() && Bukkit.isPrimaryThread()) { new ThreadSafetyListener(this); PluginKit.scp("§a线程管理系统已启用..."); } diff --git a/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java b/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java index 23feb02..b853c49 100644 --- a/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java +++ b/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java @@ -73,10 +73,12 @@ public class ThreadSafetyListener implements Listener { checkSafety(teleportEvent); } + @EventHandler public void onPluginDisable(final PluginDisableEvent pluginDisableEvent) { checkSafety(pluginDisableEvent); } + @EventHandler public void onPluginEnable(final PluginEnableEvent pluginEnableEvent) { checkSafety(pluginEnableEvent); } @@ -86,6 +88,7 @@ public class ThreadSafetyListener implements Listener { checkSafety(worldLoadEvent); } + @EventHandler public void onWorldSave(final WorldSaveEvent worldSaveEvent) { checkSafety(worldSaveEvent); }