mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-21 05:44:17 +00:00
[Bleeding] Added ability to register and listen to SubEvents. Addresses
BUKKIT-585
This commit is contained in:
parent
f0f593c956
commit
0706671a0a
2 changed files with 2 additions and 7 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue