Register each method + debug bad getMethods()
This commit is contained in:
parent
e75ff89429
commit
a3a28fe3de
@ -69,8 +69,27 @@ public abstract class ChunkListener implements Listener {
|
|||||||
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
if (Settings.IMP.TICK_LIMITER.ENABLED) {
|
||||||
PluginManager plm = Bukkit.getPluginManager();
|
PluginManager plm = Bukkit.getPluginManager();
|
||||||
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
||||||
plm.registerEvents(this, plugin);
|
|
||||||
try { plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {}
|
try { plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {}
|
||||||
|
try {
|
||||||
|
for (Method method : this.getClass().getMethods()) {
|
||||||
|
if (method.isAnnotationPresent(EventHandler.class)) {
|
||||||
|
try {
|
||||||
|
EventHandler annotation = method.getAnnotation(EventHandler.class);
|
||||||
|
EventPriority priority = annotation.priority();
|
||||||
|
boolean ignoreC = annotation.ignoreCancelled();
|
||||||
|
Class<? extends Event> event = (Class<? extends Event>) method.getParameterTypes()[0];
|
||||||
|
EventExecutor executor = EventExecutor.create(method, event);
|
||||||
|
plm.registerEvent(event, this, priority, executor, plugin, ignoreC);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Fawe.debug("Failed to register " + method + " | " + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
System.out.println("Failed to get methods");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
TaskManager.IMP.repeat(new Runnable() {
|
TaskManager.IMP.repeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user