diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index c82f731c24..1c04edfe7c 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -276,16 +276,22 @@ public class JavaPluginLoader implements PluginLoader { boolean useTimings = server.getPluginManager().useTimings(); Map, Set> ret = new HashMap, Set>(); - Method[] methods; + Set methods; try { - methods = listener.getClass().getDeclaredMethods(); + Method[] publicMethods = listener.getClass().getMethods(); + methods = new HashSet(publicMethods.length, Float.MAX_VALUE); + for (Method method : publicMethods) { + methods.add(method); + } + for (Method method : listener.getClass().getDeclaredMethods()) { + methods.add(method); + } } catch (NoClassDefFoundError e) { plugin.getLogger().severe("Plugin " + plugin.getDescription().getFullName() + " has failed to register events for " + listener.getClass() + " because " + e.getMessage() + " does not exist."); return ret; } - for (int i = 0; i < methods.length; i++) { - final Method method = methods[i]; + for (final Method method : methods) { final EventHandler eh = method.getAnnotation(EventHandler.class); if (eh == null) continue; final Class checkClass = method.getParameterTypes()[0];