diff --git a/pom.xml b/pom.xml
index 41a47a7..7f785b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
pw.yumc
Yum
- 2.6.6
+ 2.6.7
Yum
Minecraft 服务器插件管理系统
@@ -61,10 +61,9 @@
&a全新 2.X 版本 更多守护与优化
&c注意 &6- &cYum更新需要重启服务器!重启服务器!重启服务器!;
+ &b2.6.7 &6- &d兼容PerWorldPlugins...;
&b2.6.6 &6- &c修复快捷点击按钮触发命令错误...;
&b2.6.5 &6- &c修复list命令 &a添加全局能耗统计...;
- &b2.6.4 &6- &e添加从&bBukkitDev&e下载和更新...;
- &b2.6.3 &6- &a注入操作延时执行 防止部分任务未注册 添加手动注入...;
DEBUG
UTF-8
diff --git a/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java b/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java
index ecc36a9..9b02e16 100644
--- a/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java
+++ b/src/main/java/pw/yumc/Yum/inject/ListenerInjector.java
@@ -1,5 +1,6 @@
package pw.yumc.Yum.inject;
+import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -22,7 +23,7 @@ import pw.yumc.Yum.managers.MonitorManager;
public class ListenerInjector implements EventExecutor {
private final static String prefix = "§6[§bYum §a事件监控§6] ";
- private final static String inject_error = prefix + "§6插件 §b%s §c注入能耗监控失败!";
+ private final static String inject_error = prefix + "§6插件 §b%s §c注入能耗监控失败 §6注入类: §3%s!";
private final static String plugin_is_null = "插件不得为NULL!";
private final EventExecutor originalExecutor;
@@ -40,21 +41,33 @@ public class ListenerInjector implements EventExecutor {
public static void inject(final Plugin plugin) {
Validate.notNull(plugin, plugin_is_null);
- try {
- final List listeners = HandlerList.getRegisteredListeners(plugin);
- for (final RegisteredListener listener : listeners) {
+ final List listeners = HandlerList.getRegisteredListeners(plugin);
+ for (final RegisteredListener listener : listeners) {
+ try {
if (listener instanceof TimedRegisteredListener) {
return;
}
- final EventExecutor originalExecutor = Reflect.on(listener).get("executor");
- if (originalExecutor instanceof ListenerInjector) {
- return;
+ if (listener.getClass().getName().contains("PWPRegisteredListener")) {
+ final Field f = Reflect.on(listener).getDeclaredField(RegisteredListener.class, "executor");
+ f.setAccessible(true);
+ final EventExecutor originalExecutor = (EventExecutor) f.get(listener);
+ if (originalExecutor instanceof ListenerInjector) {
+ return;
+ }
+ final ListenerInjector listenerInjector = new ListenerInjector(originalExecutor, plugin);
+ f.set(listener, listenerInjector);
+ } else {
+ final EventExecutor originalExecutor = Reflect.on(listener).get("executor");
+ if (originalExecutor instanceof ListenerInjector) {
+ return;
+ }
+ final ListenerInjector listenerInjector = new ListenerInjector(originalExecutor, plugin);
+ Reflect.on(listener).set("executor", listenerInjector);
}
- final ListenerInjector listenerInjector = new ListenerInjector(originalExecutor, plugin);
- Reflect.on(listener).set("executor", listenerInjector);
+ } catch (final Throwable e) {
+ PluginKit.sc(String.format(inject_error, plugin.getName(), listener.getClass().getName()));
+ e.printStackTrace();
}
- } catch (final Throwable e) {
- PluginKit.sc(String.format(inject_error, plugin.getName()));
}
}