From 785295c65c294a65b1f8ebb2df37ee89e49dd385 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 5 Jul 2016 13:34:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=B8=E8=BD=BD=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=E5=85=B3=E9=97=AD=E7=BA=BF=E7=A8=8B=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=20=E7=BD=91=E7=BB=9CURL=E7=99=BD=E5=90=8D=E5=8D=95=E4=BC=98?= =?UTF-8?q?=E5=85=88=E4=BA=8E=E6=8F=92=E4=BB=B6=E9=BB=91=E5=90=8D=E5=8D=95?= 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 | 3 ++- .../pw/yumc/Yum/listeners/PluginNetworkListener.java | 5 ++++- .../pw/yumc/Yum/listeners/ThreadSafetyListener.java | 12 ------------ 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/pw/yumc/Yum/Yum.java b/src/main/java/pw/yumc/Yum/Yum.java index 30cd46c..149e28a 100644 --- a/src/main/java/pw/yumc/Yum/Yum.java +++ b/src/main/java/pw/yumc/Yum/Yum.java @@ -31,6 +31,7 @@ import pw.yumc.Yum.runnables.MainThreadCheckTask; */ public class Yum extends JavaPlugin { public static Thread mainThread = null; + public static final Timer task = new Timer(); @Override public FileConfiguration getConfig() { @@ -40,6 +41,7 @@ public class Yum extends JavaPlugin { @Override public void onDisable() { NetworkManager.unregister(); + task.cancel(); } @Override @@ -109,7 +111,6 @@ public class Yum extends JavaPlugin { private void initRunnable() { // 需要在主线程注册任务 if (ConfigManager.i().isMainThreadCheck() && mainThread != null) { - final Timer task = new Timer(); PluginKit.scp("§aIO管理系统已启用..."); task.scheduleAtFixedRate(new MainThreadCheckTask(mainThread), 0, 3000); } diff --git a/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java b/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java index a40e7ed..3a76226 100644 --- a/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java +++ b/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java @@ -36,6 +36,9 @@ public class PluginNetworkListener implements Listener { if (urlinfo.startsWith("socket")) { return; } + if (ConfigManager.i().getNetworkWhiteURL().contains(e.getUrl().getHost())) { + return; + } if (urlinfo.contains("yumc") || urlinfo.contains("502647092")) { final String 大神你好 = "反编译的大神们我知道你们又要说了这货有后门"; 大神你好.isEmpty(); @@ -46,7 +49,7 @@ public class PluginNetworkListener implements Listener { breakNetwork(e); return; } - if (ConfigManager.i().getNetworkWhiteURL().contains(e.getUrl().getHost()) || ConfigManager.i().getNetworkIgnoreList().contains(plugin.getName())) { + if (ConfigManager.i().getNetworkIgnoreList().contains(plugin.getName())) { return; } if (e.isPrimaryThread()) { diff --git a/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java b/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java index fe46b29..35f6010 100644 --- a/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java +++ b/src/main/java/pw/yumc/Yum/listeners/ThreadSafetyListener.java @@ -10,8 +10,6 @@ import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.server.PluginDisableEvent; -import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.WorldLoadEvent; @@ -71,16 +69,6 @@ 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); - } - @EventHandler public void onWorldLoad(final WorldLoadEvent worldLoadEvent) { checkSafety(worldLoadEvent);