Slightly optimize SimpleEventBus usage in VelocityEventManager

This commit is contained in:
Luck
2018-12-03 23:53:50 +00:00
parent 43da3d4541
commit cfae542dd2

View File

@@ -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());