diff --git a/pom.xml b/pom.xml
index 71d8ccb..d6c2ef1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
pw.yumc
Yum
- 2.6.2
+ 2.6.3
Yum
Minecraft 服务器插件管理系统
@@ -60,9 +60,10 @@
&a全新 2.X 版本 更多守护与优化
+ &e预告 &6- &e下个版本将加入从&bBukkitDev&e下载和更新...;
+ &b2.6.3 &6- &a注入操作延时执行 防止部分任务未注册 添加手动注入...;
&b2.6.2 &6- &d能耗监控添加忽略列表 &3详见monitor.yml...;
&b2.6.1 &6- &c优化能耗监控 命令别名修改为mi(防止与ESS冲突)...;
- &b2.6 &6- &a添加能耗监控系统 事件错误监控...;
DEBUG
UTF-8
diff --git a/src/main/java/pw/yumc/Yum/commands/MonitorCommand.java b/src/main/java/pw/yumc/Yum/commands/MonitorCommand.java
index c7bb484..7aed136 100644
--- a/src/main/java/pw/yumc/Yum/commands/MonitorCommand.java
+++ b/src/main/java/pw/yumc/Yum/commands/MonitorCommand.java
@@ -26,6 +26,7 @@ import cn.citycraft.PluginHelper.commands.InvokeSubCommand;
import cn.citycraft.PluginHelper.ext.kit.Reflect;
import cn.citycraft.PluginHelper.kit.StrKit;
import pw.yumc.Yum.Yum;
+import pw.yumc.Yum.api.YumAPI;
import pw.yumc.Yum.inject.CommandInjector;
import pw.yumc.Yum.inject.ListenerInjector;
import pw.yumc.Yum.inject.TaskInjector;
@@ -43,6 +44,10 @@ public class MonitorCommand implements HandlerCommands {
private final String avg_warn = "§6平均耗时: §c%.5f毫秒!";
private final String p_n_f = prefix + "§c插件 §b%s §c不存在!";
+ private final String injected = "§a插件 §b%s §a成功注入能耗监控器!";
+ private final String uninjected = "§a插件 §b%s §a成功撤销能耗监控器!";
+ private final String notEnable = "§c插件 §b%s §c未成功加载 无法执行注入!";
+
private final double um = 1000000.0;
public MonitorCommand(final Yum yum) {
@@ -51,7 +56,7 @@ public class MonitorCommand implements HandlerCommands {
cmdhandler.registerCommands(PluginTabComplete.instence);
}
- @HandlerCommand(name = "cmd", description = "查看插件命令能耗", minimumArguments = 1, possibleArguments = "插件名称")
+ @HandlerCommand(name = "cmd", description = "查看插件命令能耗", minimumArguments = 1, possibleArguments = "[插件名称]")
public void cmd(final InvokeCommandEvent e) {
final String pname = e.getArgs()[0];
final CommandSender sender = e.getSender();
@@ -88,7 +93,7 @@ public class MonitorCommand implements HandlerCommands {
}
}
- @HandlerCommand(name = "event", description = "查看插件事件能耗", minimumArguments = 1, possibleArguments = "插件名称")
+ @HandlerCommand(name = "event", description = "查看插件事件能耗", minimumArguments = 1, possibleArguments = "[插件名称]")
public void event(final InvokeCommandEvent e) throws InstantiationException, IllegalAccessException {
final String pname = e.getArgs()[0];
final CommandSender sender = e.getSender();
@@ -135,7 +140,24 @@ public class MonitorCommand implements HandlerCommands {
}
}
- @HandlerCommand(name = "task", description = "查看插件任务能耗", minimumArguments = 1, possibleArguments = "插件名称")
+ @HandlerCommand(name = "inject", aliases = "i", description = "注入能耗监控器", minimumArguments = 1, possibleArguments = "[插件名称]")
+ public void inject(final InvokeCommandEvent e) {
+ final String pname = e.getArgs()[0];
+ final CommandSender sender = e.getSender();
+ final Plugin plugin = Bukkit.getPluginManager().getPlugin(pname);
+ if (plugin == null) {
+ sender.sendMessage(String.format(p_n_f, pname));
+ return;
+ }
+ if (plugin.isEnabled()) {
+ YumAPI.inject(plugin);
+ sender.sendMessage(String.format(prefix + injected, pname));
+ } else {
+ sender.sendMessage(String.format(prefix + notEnable, pname));
+ }
+ }
+
+ @HandlerCommand(name = "task", description = "查看插件任务能耗", minimumArguments = 1, possibleArguments = "[插件名称]")
public void task(final InvokeCommandEvent e) {
final String pname = e.getArgs()[0];
final CommandSender sender = e.getSender();
@@ -164,4 +186,19 @@ public class MonitorCommand implements HandlerCommands {
}
}
}
+
+ @HandlerCommand(name = "uninject", aliases = "ui", description = "撤销能耗监控器", minimumArguments = 1, possibleArguments = "[插件名称]")
+ public void uninject(final InvokeCommandEvent e) {
+ final String pname = e.getArgs()[0];
+ final CommandSender sender = e.getSender();
+ final Plugin plugin = Bukkit.getPluginManager().getPlugin(pname);
+ if (plugin == null) {
+ sender.sendMessage(String.format(p_n_f, pname));
+ return;
+ }
+ if (plugin.isEnabled()) {
+ YumAPI.uninject(plugin);
+ sender.sendMessage(String.format(prefix + uninjected, pname));
+ }
+ }
}
diff --git a/src/main/java/pw/yumc/Yum/listeners/PluginListener.java b/src/main/java/pw/yumc/Yum/listeners/PluginListener.java
index ffceebf..11eabb8 100644
--- a/src/main/java/pw/yumc/Yum/listeners/PluginListener.java
+++ b/src/main/java/pw/yumc/Yum/listeners/PluginListener.java
@@ -29,6 +29,11 @@ public class PluginListener implements Listener {
@EventHandler
public void onPluginEnable(final PluginEnableEvent e) {
- YumAPI.inject(e.getPlugin());
+ PluginKit.runTaskLater(new Runnable() {
+ @Override
+ public void run() {
+ YumAPI.inject(e.getPlugin());
+ }
+ }, 60);
}
}
diff --git a/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java b/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java
index 3a76226..015ff43 100644
--- a/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java
+++ b/src/main/java/pw/yumc/Yum/listeners/PluginNetworkListener.java
@@ -39,7 +39,7 @@ public class PluginNetworkListener implements Listener {
if (ConfigManager.i().getNetworkWhiteURL().contains(e.getUrl().getHost())) {
return;
}
- if (urlinfo.contains("yumc") || urlinfo.contains("502647092")) {
+ if (urlinfo.contains("yumc") || urlinfo.contains("citycraft") || urlinfo.contains("502647092")) {
final String 大神你好 = "反编译的大神们我知道你们又要说了这货有后门";
大神你好.isEmpty();
return;
diff --git a/src/main/resources/network.yml b/src/main/resources/network.yml
index a972d64..b8b4d20 100644
--- a/src/main/resources/network.yml
+++ b/src/main/resources/network.yml
@@ -25,4 +25,5 @@ WhiteURL:
- mcstats.org
- report.mcstats.org
- www.spigotmc.org
-- dev.bukkit.org
\ No newline at end of file
+- dev.bukkit.org
+- api.curseforge.com
\ No newline at end of file