Source:
public void registerListener(PluginContainer plugin, Object listenerObject) { checkNotNull(plugin, "plugin"); checkNotNull(listenerObject, "listener"); if (this.registeredListeners.contains(listenerObject)) { SpongeImpl.getLogger().warn("Plugin attempted to register an already registered listener ({})", plugin.getId(), listenerObject.getClass().getName()); Thread.dumpStack(); return; } List<RegisteredListener<? extends Event>> handlers = Lists.newArrayList(); Set<Method> invalidMethods = new HashSet<>(); Class<?> handle = listenerObject.getClass(); for (Method method : handle.getMethods()) { Listener listener = method.getAnnotation(Listener.class); if (listener != null) { if (isValidHandler(method)) { @SuppressWarnings("unchecked") Class<? extends Event> eventClass = (Class<? extends Event>) method.getParameterTypes()[0]; AnnotatedEventListener handler; try { handler = this.handlerFactory.create(listenerObject, method); } catch (Exception e) { SpongeImpl.getLogger().error("Failed to create handler for on {}", method, handle, e); continue; } handlers.add(createRegistration(plugin, eventClass, listener, handler)); } else { invalidMethods.add(method); } } } for (Class<?> handleParent = handle; handleParent != Object.class; handleParent = handle.getSuperclass()) { for (Method method : handleParent.getDeclaredMethods()) { if (method.getAnnotation(Listener.class) != null && !isValidHandler(method)) { invalidMethods.add(method); } } } for (Method method : invalidMethods) { SpongeImpl.getLogger().warn("The method on has @{} but has the wrong signature", method, method.getDeclaringClass().getName(), Listener.class.getName()); } this.registeredListeners.add(listenerObject); register(handlers); }

Target:
public void registerListener(PluginContainer plugin, Object listenerObject) { checkNotNull(plugin, "plugin"); checkNotNull(listenerObject, "listener"); if (this.registeredListeners.contains(listenerObject)) { this.logger.warn("Plugin attempted to register an already registered listener ({})", plugin.getId(), listenerObject.getClass().getName()); Thread.dumpStack(); return; } List<RegisteredListener<? extends Event>> handlers = Lists.newArrayList(); Map<Method, String> methodErrors = new HashMap<>(); Class<?> handle = listenerObject.getClass(); for (Method method : handle.getMethods()) { Listener listener = method.getAnnotation(Listener.class); if (listener != null) { String error = getHandlerErrorOrNull(method); if (error == null) { @SuppressWarnings("unchecked") Class<? extends Event> eventClass = (Class<? extends Event>) method.getParameterTypes()[0]; AnnotatedEventListener handler; try { handler = this.handlerFactory.create(listenerObject, method); } catch (Exception e) { this.logger.error("Failed to create handler for on {}", method, handle, e); continue; } handlers.add(createRegistration(plugin, eventClass, listener, handler)); } else { methodErrors.put(method, error); } } } for (Class<?> handleParent = handle; handleParent != Object.class; handleParent = handle.getSuperclass()) { for (Method method : handleParent.getDeclaredMethods()) { if (method.getAnnotation(Listener.class) != null && !methodErrors.containsKey(method)) { String error = getHandlerErrorOrNull(method); if (error != null) { methodErrors.put(method, error); } } } } for (Map.Entry<Method, String> method : methodErrors.entrySet()) { this.logger.warn("Invalid listener method in {}: {}", method.getKey(), method.getKey().getDeclaringClass().getName(), method.getValue()); } this.registeredListeners.add(listenerObject); register(handlers); }