Slightly optimize SimpleEventBus usage in VelocityEventManager
This commit is contained in:
@@ -47,7 +47,13 @@ public class VelocityEventManager implements EventManager {
|
|||||||
public VelocityEventManager(PluginManager pluginManager) {
|
public VelocityEventManager(PluginManager pluginManager) {
|
||||||
PluginClassLoader cl = new PluginClassLoader(new URL[0]);
|
PluginClassLoader cl = new PluginClassLoader(new URL[0]);
|
||||||
cl.addToClassloaders();
|
cl.addToClassloaders();
|
||||||
this.bus = new SimpleEventBus<>(Object.class);
|
this.bus = new SimpleEventBus<Object>(Object.class) {
|
||||||
|
@Override
|
||||||
|
protected boolean shouldPost(@NonNull Object event, @NonNull EventSubscriber<?> subscriber) {
|
||||||
|
// Velocity doesn't use Cancellable or generic events, so we can skip those checks.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
this.methodAdapter = new SimpleMethodSubscriptionAdapter<>(bus,
|
this.methodAdapter = new SimpleMethodSubscriptionAdapter<>(bus,
|
||||||
new ASMEventExecutorFactory<>(cl),
|
new ASMEventExecutorFactory<>(cl),
|
||||||
new VelocityMethodScanner());
|
new VelocityMethodScanner());
|
||||||
|
Reference in New Issue
Block a user