From 94bf64e36b193b938c51c42371432beca8b76537 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 14 Jul 2016 17:20:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=83=BD=E8=80=97?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E5=BC=80=E5=85=B3?= 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 | 9 ++++++--- .../java/pw/yumc/Yum/managers/ConfigManager.java | 14 ++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/pw/yumc/Yum/Yum.java b/src/main/java/pw/yumc/Yum/Yum.java index 341f8dc..b722795 100644 --- a/src/main/java/pw/yumc/Yum/Yum.java +++ b/src/main/java/pw/yumc/Yum/Yum.java @@ -45,7 +45,6 @@ public class Yum extends JavaPlugin { @Override public void onDisable() { NetworkManager.unregister(); - } @Override @@ -58,9 +57,11 @@ public class Yum extends JavaPlugin { initListeners(); initRunnable(); new VersionChecker(this); - YumAPI.updateInject(); YumAPI.updateRepo(Bukkit.getConsoleSender()); YumAPI.updateCheck(Bukkit.getConsoleSender()); + if (ConfigManager.i().isMonitorEnable()) { + YumAPI.updateInject(); + } } @Override @@ -87,7 +88,6 @@ public class Yum extends JavaPlugin { * 初始化监听 */ private void initListeners() { - new PluginListener(); if (ConfigManager.i().isSetOpEnable()) { try { final ClassLoader cl = Class.forName("pw.yumc.injected.event.SetOpEvent").getClassLoader(); @@ -110,6 +110,9 @@ public class Yum extends JavaPlugin { new ThreadSafetyListener(this); PluginKit.scp("§a线程管理系统已启用..."); } + if (ConfigManager.i().isMonitorEnable()) { + new PluginListener(); + } } /** diff --git a/src/main/java/pw/yumc/Yum/managers/ConfigManager.java b/src/main/java/pw/yumc/Yum/managers/ConfigManager.java index da78e12..82645e3 100644 --- a/src/main/java/pw/yumc/Yum/managers/ConfigManager.java +++ b/src/main/java/pw/yumc/Yum/managers/ConfigManager.java @@ -18,16 +18,18 @@ public class ConfigManager { public final FileConfig setop; public final FileConfig network; public final FileConfig thread; - - public static ConfigManager i() { - return i; - } + public final FileConfig monitor; public ConfigManager(final JavaPlugin plugin) { config = new FileConfig(plugin); setop = new FileConfig(plugin, "setop.yml"); network = new FileConfig(plugin, "network.yml"); thread = new FileConfig(plugin, "thread.yml"); + monitor = new FileConfig(plugin, "monitor.yml"); + } + + public static ConfigManager i() { + return i; } public List getBlackList() { @@ -66,6 +68,10 @@ public class ConfigManager { return thread.getBoolean("MainThreadCheck", true); } + public boolean isMonitorEnable() { + return monitor.getBoolean(ENABLE, true); + } + public boolean isNetworkDebug() { return network.getBoolean("NetworkDebug", false); }