[Bleeding] Added ability to register and listen to SubEvents. Addresses

BUKKIT-585

By: Feildmaster <admin@feildmaster.com>
This commit is contained in:
Bukkit/Spigot 2012-01-25 09:49:12 -06:00
parent 6492eb9683
commit 4e48b4725f
2 changed files with 2 additions and 7 deletions

View file

@ -537,12 +537,7 @@ public final class SimplePluginManager implements PluginManager {
}
for (Map.Entry<Class<? extends Event>, Set<RegisteredListener>> entry : plugin.getPluginLoader().createRegisteredListeners(listener, plugin).entrySet()) {
Class<? extends Event> delegatedClass = getRegistrationClass(entry.getKey());
if (!entry.getKey().equals(delegatedClass)) {
plugin.getServer().getLogger().severe("Plugin attempted to register delegated event class " + entry.getKey() + ". It should be using " + delegatedClass + "!");
continue;
}
getEventListeners(delegatedClass).registerAll(entry.getValue());
getEventListeners(getRegistrationClass(entry.getKey())).registerAll(entry.getValue());
}
}

View file

@ -1019,7 +1019,7 @@ public class JavaPluginLoader implements PluginLoader {
public void execute(Listener listener, Event event) throws EventException {
try {
if (!eventClass.isAssignableFrom(event.getClass())) {
throw new EventException("Wrong event type passed to registered method");
return;
}
method.invoke(listener, event);
} catch (Throwable t) {