Fix NPE in BukkitEvent
This commit is contained in:
parent
616ae69d41
commit
b2cd7e0bda
@ -58,7 +58,10 @@ public class BukkitEvent {
|
|||||||
// method retrieved from OB.plugin.SimplePluginManager#getEventListeners
|
// method retrieved from OB.plugin.SimplePluginManager#getEventListeners
|
||||||
public static HandlerList getHandlerList(Class<? extends Event> type) {
|
public static HandlerList getHandlerList(Class<? extends Event> type) {
|
||||||
try {
|
try {
|
||||||
return (HandlerList) Reflect.ofClass(getRegistrationClass(type)).method("getHandlerList").invokeStatic();
|
Class<? extends Event> actualClass = getRegistrationClass(type);
|
||||||
|
if (actualClass == null)
|
||||||
|
return null;
|
||||||
|
return (HandlerList) Reflect.ofClass(actualClass).method("getHandlerList").invokeStatic();
|
||||||
}
|
}
|
||||||
catch (ReflectiveOperationException e) {
|
catch (ReflectiveOperationException e) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user