From 627ec3045c9c4c4d88425699ffacb54de4fae1d0 Mon Sep 17 00:00:00 2001 From: Vankka Date: Mon, 28 Mar 2022 17:34:16 +0300 Subject: [PATCH] Remove unnecessary code in EventBus --- .../com/discordsrv/common/event/bus/EventBusImpl.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/discordsrv/common/event/bus/EventBusImpl.java b/common/src/main/java/com/discordsrv/common/event/bus/EventBusImpl.java index 04166f95..e95dad73 100644 --- a/common/src/main/java/com/discordsrv/common/event/bus/EventBusImpl.java +++ b/common/src/main/java/com/discordsrv/common/event/bus/EventBusImpl.java @@ -75,12 +75,11 @@ public class EventBusImpl implements EventBus { List suppressedMethods = new ArrayList<>(); List methods = new ArrayList<>(); - EnumMap> methodsByPriority = new EnumMap<>(EventPriority.class); Class currentClass = listenerClass; do { for (Method method : currentClass.getDeclaredMethods()) { - checkMethod(eventListener, listenerClass, method, suppressedMethods, methods, methodsByPriority); + checkMethod(eventListener, listenerClass, method, suppressedMethods, methods); } } while ((currentClass = currentClass.getSuperclass()) != null); @@ -97,8 +96,7 @@ public class EventBusImpl implements EventBus { } private void checkMethod(Object eventListener, Class listenerClass, Method method, - List suppressedMethods, List methods, - EnumMap> methodsByPriority) { + List suppressedMethods, List methods) { Subscribe annotation = method.getAnnotation(Subscribe.class); if (annotation == null) { return; @@ -144,12 +142,8 @@ public class EventBusImpl implements EventBus { return; } - EventPriority eventPriority = annotation.priority(); EventListenerImpl listener = new EventListenerImpl(eventListener, listenerClass, annotation, firstParameter, method); - methods.add(listener); - methodsByPriority.computeIfAbsent(eventPriority, key -> new CopyOnWriteArrayList<>()) - .add(listener); } private Throwable createReasonException(String message) {