feat: 卸载插件时关闭线程任务 网络URL白名单优先于插件黑名单

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-05 13:34:16 +08:00
parent 98f12dc41e
commit 785295c65c
3 changed files with 6 additions and 14 deletions

View File

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

View File

@ -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()) {

View File

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