geforkt von Mirrors/Velocity
Warn if someone tries to register the plugin instance as a listener
Dieser Commit ist enthalten in:
Ursprung
79d566bcee
Commit
97d541d146
@ -58,6 +58,9 @@ public class VelocityEventManager implements EventManager {
|
|||||||
Preconditions.checkNotNull(plugin, "plugin");
|
Preconditions.checkNotNull(plugin, "plugin");
|
||||||
Preconditions.checkNotNull(listener, "listener");
|
Preconditions.checkNotNull(listener, "listener");
|
||||||
Preconditions.checkArgument(pluginManager.fromInstance(plugin).isPresent(), "Specified plugin is not loaded");
|
Preconditions.checkArgument(pluginManager.fromInstance(plugin).isPresent(), "Specified plugin is not loaded");
|
||||||
|
if (plugin == listener && registeredListenersByPlugin.containsEntry(plugin, plugin)) {
|
||||||
|
throw new IllegalArgumentException("Trying to register the plugin main instance. Velocity already takes care of this for you.");
|
||||||
|
}
|
||||||
registeredListenersByPlugin.put(plugin, listener);
|
registeredListenersByPlugin.put(plugin, listener);
|
||||||
bus.register(listener);
|
bus.register(listener);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren