diff options
author | Jonas Konrad <me@yawk.at> | 2015-05-18 11:14:47 +0200 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-05-18 20:08:38 +1000 |
commit | b333b58c05a0392f3fcf825028c058518a50d1c7 (patch) | |
tree | baaff40fb88d39992f820e9fb3085e3483f91009 /src/main | |
parent | 65de010efb1a3a5ddad36160b8ad9b49420306e8 (diff) | |
download | bukkit-b333b58c05a0392f3fcf825028c058518a50d1c7.tar bukkit-b333b58c05a0392f3fcf825028c058518a50d1c7.tar.gz bukkit-b333b58c05a0392f3fcf825028c058518a50d1c7.tar.lz bukkit-b333b58c05a0392f3fcf825028c058518a50d1c7.tar.xz bukkit-b333b58c05a0392f3fcf825028c058518a50d1c7.zip |
SPIGOT-893: Fix bridge method registering generic listeners twice
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 687029fb..21187717 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -250,6 +250,11 @@ public final class JavaPluginLoader implements PluginLoader { for (final Method method : methods) { final EventHandler eh = method.getAnnotation(EventHandler.class); if (eh == null) continue; + // Do not register bridge or synthetic methods to avoid event duplication + // Fixes SPIGOT-893 + if (method.isBridge() || method.isSynthetic()) { + continue; + } final Class<?> checkClass; if (method.getParameterTypes().length != 1 || !Event.class.isAssignableFrom(checkClass = method.getParameterTypes()[0])) { plugin.getLogger().severe(plugin.getDescription().getFullName() + " attempted to register an invalid EventHandler method signature \"" + method.toGenericString() + "\" in " + listener.getClass()); |