mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 06:48:23 +01:00
#771: Throw IllegalAccessException with non-static getHandlerList
Also add specifier for which event causes the issue By: Martoph <sager1018@gmail.com>
This commit is contained in:
parent
b2eb98d8eb
commit
8c38fbb68a
1 changed files with 7 additions and 1 deletions
|
@ -8,6 +8,7 @@ import com.google.common.graph.MutableGraph;
|
|||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
@ -656,9 +657,14 @@ public final class SimplePluginManager implements PluginManager {
|
|||
try {
|
||||
Method method = getRegistrationClass(type).getDeclaredMethod("getHandlerList");
|
||||
method.setAccessible(true);
|
||||
|
||||
if (!Modifier.isStatic(method.getModifiers())) {
|
||||
throw new IllegalAccessException("getHandlerList must be static");
|
||||
}
|
||||
|
||||
return (HandlerList) method.invoke(null);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalPluginAccessException(e.toString());
|
||||
throw new IllegalPluginAccessException("Error while registering listener for event type " + type.toString() + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue