Fix potential issue with custom events where the constructor is not visible from the EventBus class, Should never arise but meh.

This commit is contained in:
LexManos 2012-09-11 17:49:21 -07:00
parent aeebb6e9f9
commit de47895e02

View file

@ -1,5 +1,6 @@
package net.minecraftforge.event; package net.minecraftforge.event;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set; import java.util.Set;
@ -65,7 +66,9 @@ public class EventBus
{ {
try try
{ {
Event event = (Event)eventType.newInstance(); Constructor<?> ctr = eventType.getConstructor();
ctr.setAccessible(true);
Event event = (Event)ctr.newInstance();
ASMEventHandler listener = new ASMEventHandler(target, method); ASMEventHandler listener = new ASMEventHandler(target, method);
event.getListenerList().register(busID, listener.getPriority(), listener); event.getListenerList().register(busID, listener.getPriority(), listener);