From cfae542dd21655210037ef93ed226ecff3d7cd14 Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 3 Dec 2018 23:53:50 +0000 Subject: [PATCH] Slightly optimize SimpleEventBus usage in VelocityEventManager --- .../proxy/plugin/VelocityEventManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/plugin/VelocityEventManager.java b/proxy/src/main/java/com/velocitypowered/proxy/plugin/VelocityEventManager.java index a9d9f8ce5..b0ec5cfdd 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/plugin/VelocityEventManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/plugin/VelocityEventManager.java @@ -47,7 +47,13 @@ public class VelocityEventManager implements EventManager { public VelocityEventManager(PluginManager pluginManager) { PluginClassLoader cl = new PluginClassLoader(new URL[0]); cl.addToClassloaders(); - this.bus = new SimpleEventBus<>(Object.class); + this.bus = new SimpleEventBus(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, new ASMEventExecutorFactory<>(cl), new VelocityMethodScanner());