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); }