mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-09-18 21:45:12 +00:00
Validate method parameters when registering events. Fixes BUKKIT-3779
This commit is contained in:
parent
7dcf22262a
commit
823c6c0ec6
1 changed files with 2 additions and 2 deletions
|
@ -380,8 +380,8 @@ public class JavaPluginLoader implements PluginLoader {
|
|||
for (final Method method : methods) {
|
||||
final EventHandler eh = method.getAnnotation(EventHandler.class);
|
||||
if (eh == null) continue;
|
||||
final Class<?> checkClass = method.getParameterTypes()[0];
|
||||
if (!Event.class.isAssignableFrom(checkClass) || method.getParameterTypes().length != 1) {
|
||||
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());
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue