mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 22:38:46 +00:00
feat: 卸载插件时关闭线程任务 网络URL白名单优先于插件黑名单
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
98f12dc41e
commit
785295c65c
@ -31,6 +31,7 @@ import pw.yumc.Yum.runnables.MainThreadCheckTask;
|
|||||||
*/
|
*/
|
||||||
public class Yum extends JavaPlugin {
|
public class Yum extends JavaPlugin {
|
||||||
public static Thread mainThread = null;
|
public static Thread mainThread = null;
|
||||||
|
public static final Timer task = new Timer();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileConfiguration getConfig() {
|
public FileConfiguration getConfig() {
|
||||||
@ -40,6 +41,7 @@ public class Yum extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
NetworkManager.unregister();
|
NetworkManager.unregister();
|
||||||
|
task.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,7 +111,6 @@ public class Yum extends JavaPlugin {
|
|||||||
private void initRunnable() {
|
private void initRunnable() {
|
||||||
// 需要在主线程注册任务
|
// 需要在主线程注册任务
|
||||||
if (ConfigManager.i().isMainThreadCheck() && mainThread != null) {
|
if (ConfigManager.i().isMainThreadCheck() && mainThread != null) {
|
||||||
final Timer task = new Timer();
|
|
||||||
PluginKit.scp("§aIO管理系统已启用...");
|
PluginKit.scp("§aIO管理系统已启用...");
|
||||||
task.scheduleAtFixedRate(new MainThreadCheckTask(mainThread), 0, 3000);
|
task.scheduleAtFixedRate(new MainThreadCheckTask(mainThread), 0, 3000);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ public class PluginNetworkListener implements Listener {
|
|||||||
if (urlinfo.startsWith("socket")) {
|
if (urlinfo.startsWith("socket")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (ConfigManager.i().getNetworkWhiteURL().contains(e.getUrl().getHost())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (urlinfo.contains("yumc") || urlinfo.contains("502647092")) {
|
if (urlinfo.contains("yumc") || urlinfo.contains("502647092")) {
|
||||||
final String 大神你好 = "反编译的大神们我知道你们又要说了这货有后门";
|
final String 大神你好 = "反编译的大神们我知道你们又要说了这货有后门";
|
||||||
大神你好.isEmpty();
|
大神你好.isEmpty();
|
||||||
@ -46,7 +49,7 @@ public class PluginNetworkListener implements Listener {
|
|||||||
breakNetwork(e);
|
breakNetwork(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ConfigManager.i().getNetworkWhiteURL().contains(e.getUrl().getHost()) || ConfigManager.i().getNetworkIgnoreList().contains(plugin.getName())) {
|
if (ConfigManager.i().getNetworkIgnoreList().contains(plugin.getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.isPrimaryThread()) {
|
if (e.isPrimaryThread()) {
|
||||||
|
@ -10,8 +10,6 @@ import org.bukkit.event.inventory.InventoryOpenEvent;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
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.ChunkLoadEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
@ -71,16 +69,6 @@ public class ThreadSafetyListener implements Listener {
|
|||||||
checkSafety(teleportEvent);
|
checkSafety(teleportEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPluginDisable(final PluginDisableEvent pluginDisableEvent) {
|
|
||||||
checkSafety(pluginDisableEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPluginEnable(final PluginEnableEvent pluginEnableEvent) {
|
|
||||||
checkSafety(pluginEnableEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWorldLoad(final WorldLoadEvent worldLoadEvent) {
|
public void onWorldLoad(final WorldLoadEvent worldLoadEvent) {
|
||||||
checkSafety(worldLoadEvent);
|
checkSafety(worldLoadEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user