From ac203b1dbf0d749fa747e5116d43a1fea04c0e0a Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Mon, 1 Jun 2015 16:43:22 +1000 Subject: [PATCH] [SPIGOT-950] Make handlerList requirement really obvious. By: md_5 --- paper-api/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(-) diff --git a/paper-api/src/main/java/org/bukkit/event/Event.java b/paper-api/src/main/java/org/bukkit/event/Event.java index fa29c27e11..6677e1bd6f 100644 --- a/paper-api/src/main/java/org/bukkit/event/Event.java +++ b/paper-api/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/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java index d2fe422cad..e51658df56 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/paper-api/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!"); } } }