geforkt von Mirrors/Paper
Validate method parameters when registering events. Fixes BUKKIT-3779
By: feildmaster <admin@feildmaster.com>
Dieser Commit ist enthalten in:
Ursprung
6e7076fd64
Commit
50f297d941
@ -380,8 +380,8 @@ public class JavaPluginLoader implements PluginLoader {
|
|||||||
for (final Method method : methods) {
|
for (final Method method : methods) {
|
||||||
final EventHandler eh = method.getAnnotation(EventHandler.class);
|
final EventHandler eh = method.getAnnotation(EventHandler.class);
|
||||||
if (eh == null) continue;
|
if (eh == null) continue;
|
||||||
final Class<?> checkClass = method.getParameterTypes()[0];
|
final Class<?> checkClass;
|
||||||
if (!Event.class.isAssignableFrom(checkClass) || method.getParameterTypes().length != 1) {
|
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());
|
plugin.getLogger().severe(plugin.getDescription().getFullName() + " attempted to register an invalid EventHandler method signature \"" + method.toGenericString() + "\" in " + listener.getClass());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren