From 29d17a43e349820107c993ae092526df95c5f479 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 5 Jul 2016 19:06:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=8A=A8=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E8=AE=A1=E6=95=B0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- src/main/java/pw/yumc/Yum/Yum.java | 4 +++- src/main/java/pw/yumc/Yum/runnables/MainThreadCheckTask.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/pw/yumc/Yum/Yum.java b/src/main/java/pw/yumc/Yum/Yum.java index 42b6710..3428d8c 100644 --- a/src/main/java/pw/yumc/Yum/Yum.java +++ b/src/main/java/pw/yumc/Yum/Yum.java @@ -43,7 +43,6 @@ public class Yum extends JavaPlugin { @Override public void onDisable() { NetworkManager.unregister(); - tt.cancel(); } @Override @@ -114,6 +113,9 @@ public class Yum extends JavaPlugin { // 需要在主线程注册任务 if (ConfigManager.i().isMainThreadCheck() && mainThread != null) { PluginKit.scp("§aIO管理系统已启用..."); + if (tt != null) { + tt.cancel(); + } task.scheduleAtFixedRate(tt = new MainThreadCheckTask(mainThread), 0, 5000); } } diff --git a/src/main/java/pw/yumc/Yum/runnables/MainThreadCheckTask.java b/src/main/java/pw/yumc/Yum/runnables/MainThreadCheckTask.java index 3b2d90c..4b51b26 100644 --- a/src/main/java/pw/yumc/Yum/runnables/MainThreadCheckTask.java +++ b/src/main/java/pw/yumc/Yum/runnables/MainThreadCheckTask.java @@ -66,6 +66,8 @@ public class MainThreadCheckTask extends TimerTask { } else { stopTime = 0; } + } else { + stopTime = 0; } } }