mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
[Bleeding] Added ability to register and listen to SubEvents. Addresses
BUKKIT-585 By: Feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
6492eb9683
commit
4e48b4725f
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