From a5af83911d4d1ea1267b256e02e080800ced298f Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 1 Jun 2015 16:43:22 +1000 Subject: [SPIGOT-950] Make handlerList requirement really obvious. --- src/main/java/org/bukkit/event/Event.java | 2 ++ src/main/java/org/bukkit/plugin/SimplePluginManager.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java index fa29c27e..6677e1bd 100644 --- a/src/main/java/org/bukkit/event/Event.java +++ b/src/main/java/org/bukkit/event/Event.java @@ -5,6 +5,8 @@ import org.bukkit.plugin.PluginManager; /** * Represents an event. * + * All events require a static method named getHandlerList() which returns the same {@link HandlerList} as {@link #getHandlers()}. + * * @see PluginManager#callEvent(Event) * @see PluginManager#registerEvents(Listener,Plugin) */ diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java index d2fe422c..e51658df 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -582,7 +582,7 @@ public final class SimplePluginManager implements PluginManager { && Event.class.isAssignableFrom(clazz.getSuperclass())) { return getRegistrationClass(clazz.getSuperclass().asSubclass(Event.class)); } else { - throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName()); + throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName() + ". Static getHandlerList method required!"); } } } -- cgit v1.2.3