From b3dea9a5e33abc89eb38b8984a1367487e4dcdc8 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 30 Jun 2016 14:26:41 +0800 Subject: [PATCH] Signed-off-by: 502647092 --- pom.xml | 3 ++- src/main/java/pw/yumc/Yum/Yum.java | 2 +- src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) 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); }