// Path: src/main/java/lilypad/bukkit/connect/util/ReflectionUtils.java
// public class ReflectionUtils {
// 
// 	private static final Field FIELD_MODIFIERS;
// 	private static final Field FIELD_ACCESSSOR;
// 	private static final Field FIELD_ACCESSSOR_OVERRIDE;
// 	private static final Field FIELD_ROOT;
// 
// 	static {
// 		if (!System.getProperty("java.version").startsWith("1.8")) {
// 			try {
// 				getFilterMap(Field.class).clear();
// 			} catch (Exception exception) {
// 				exception.printStackTrace();
// 			}
// 		}
// 
// 		Field fieldModifiers = null;
// 		Field fieldAccessor = null;
// 		Field fieldAccessorOverride = null;
// 		Field fieldRoot = null;
// 		try {
// 			fieldModifiers = Field.class.getDeclaredField("modifiers");
// 			fieldModifiers.setAccessible(true);
// 			fieldAccessor = Field.class.getDeclaredField("fieldAccessor");
// 			fieldAccessor.setAccessible(true);
// 			fieldAccessorOverride = Field.class.getDeclaredField("overrideFieldAccessor");
// 			fieldAccessorOverride.setAccessible(true);
// 			fieldRoot = Field.class.getDeclaredField("root");
// 			fieldRoot.setAccessible(true);
// 		} catch (Exception exception) {
// 			exception.printStackTrace();
// 		}
// 		FIELD_MODIFIERS = fieldModifiers;
// 		FIELD_ACCESSSOR = fieldAccessor;
// 		FIELD_ACCESSSOR_OVERRIDE = fieldAccessorOverride;
// 		FIELD_ROOT = fieldRoot;
// 	}
// 
// 	public static void setFinalField(Class<?> objectClass, Object object, String fieldName, Object value) throws Exception {
// 		Field field = objectClass.getDeclaredField(fieldName);
// 		field.setAccessible(true);
// 
// 		if (Modifier.isFinal(field.getModifiers())) {
// 			FIELD_MODIFIERS.setInt(field, field.getModifiers() & ~Modifier.FINAL);
// 			Field currentField = field;
// 			do {
// 				FIELD_ACCESSSOR.set(currentField, null);
// 				FIELD_ACCESSSOR_OVERRIDE.set(currentField, null);
// 			} while((currentField = (Field) FIELD_ROOT.get(currentField)) != null);
// 		}
// 		
// 		field.set(object, value);
// 	}
// 
// 	@SuppressWarnings("unchecked")
// 	public static <T> T getPrivateField(Class<?> objectClass, Object object, Class<T> fieldClass, String fieldName) throws Exception {
// 		Field field = objectClass.getDeclaredField(fieldName);
// 		field.setAccessible(true);
// 		return (T) field.get(object);
// 	}
// 
// 	@SuppressWarnings("unchecked")
// 	public static <T extends AccessibleObject & Member> Map<Class<?>, String[]> getFilterMap(Class<T> clazz) throws Exception {
// 		if (Constructor.class.isAssignableFrom(clazz)) {
// 			return null;
// 		}
// 		Method getDeclaredFields0M = Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class);
// 		getDeclaredFields0M.setAccessible(true);
// 		Field[] fields = (Field[]) getDeclaredFields0M.invoke(Class.forName("jdk.internal.reflect.Reflection"), false);
// 		Field field = null;
// 		for (Field f : fields) {
// 			if (f.getName().equals(clazz.getSimpleName().toLowerCase() + "FilterMap")) {
// 				field = f;
// 			}
// 		}
// 		Method setAccessible0M = AccessibleObject.class.getDeclaredMethod("setAccessible0", boolean.class);
// 		setAccessible0M.setAccessible(true);
// 		setAccessible0M.invoke(field, true);
// 		return (Map<Class<?>, String[]>) field.get(null);
// 	}
// 
// }


import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import lilypad.bukkit.connect.util.ReflectionUtils;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredListener;
package lilypad.bukkit.connect.injector;




public class HandlerListInjector extends HandlerList {

	@SuppressWarnings("unchecked")
	public static void prioritize(Plugin plugin, Class<? extends Event> event) throws Exception {
// Path: src/main/java/lilypad/bukkit/connect/util/ReflectionUtils.java
// public class ReflectionUtils {
// 
// 	private static final Field FIELD_MODIFIERS;
// 	private static final Field FIELD_ACCESSSOR;
// 	private static final Field FIELD_ACCESSSOR_OVERRIDE;
// 	private static final Field FIELD_ROOT;
// 
// 	static {
// 		if (!System.getProperty("java.version").startsWith("1.8")) {
// 			try {
// 				getFilterMap(Field.class).clear();
// 			} catch (Exception exception) {
// 				exception.printStackTrace();
// 			}
// 		}
// 
// 		Field fieldModifiers = null;
// 		Field fieldAccessor = null;
// 		Field fieldAccessorOverride = null;
// 		Field fieldRoot = null;
// 		try {
// 			fieldModifiers = Field.class.getDeclaredField("modifiers");
// 			fieldModifiers.setAccessible(true);
// 			fieldAccessor = Field.class.getDeclaredField("fieldAccessor");
// 			fieldAccessor.setAccessible(true);
// 			fieldAccessorOverride = Field.class.getDeclaredField("overrideFieldAccessor");
// 			fieldAccessorOverride.setAccessible(true);
// 			fieldRoot = Field.class.getDeclaredField("root");
// 			fieldRoot.setAccessible(true);
// 		} catch (Exception exception) {
// 			exception.printStackTrace();
// 		}
// 		FIELD_MODIFIERS = fieldModifiers;
// 		FIELD_ACCESSSOR = fieldAccessor;
// 		FIELD_ACCESSSOR_OVERRIDE = fieldAccessorOverride;
// 		FIELD_ROOT = fieldRoot;
// 	}
// 
// 	public static void setFinalField(Class<?> objectClass, Object object, String fieldName, Object value) throws Exception {
// 		Field field = objectClass.getDeclaredField(fieldName);
// 		field.setAccessible(true);
// 
// 		if (Modifier.isFinal(field.getModifiers())) {
// 			FIELD_MODIFIERS.setInt(field, field.getModifiers() & ~Modifier.FINAL);
// 			Field currentField = field;
// 			do {
// 				FIELD_ACCESSSOR.set(currentField, null);
// 				FIELD_ACCESSSOR_OVERRIDE.set(currentField, null);
// 			} while((currentField = (Field) FIELD_ROOT.get(currentField)) != null);
// 		}
// 		
// 		field.set(object, value);
// 	}
// 
// 	@SuppressWarnings("unchecked")
// 	public static <T> T getPrivateField(Class<?> objectClass, Object object, Class<T> fieldClass, String fieldName) throws Exception {
// 		Field field = objectClass.getDeclaredField(fieldName);
// 		field.setAccessible(true);
// 		return (T) field.get(object);
// 	}
// 
// 	@SuppressWarnings("unchecked")
// 	public static <T extends AccessibleObject & Member> Map<Class<?>, String[]> getFilterMap(Class<T> clazz) throws Exception {
// 		if (Constructor.class.isAssignableFrom(clazz)) {
// 			return null;
// 		}
// 		Method getDeclaredFields0M = Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class);
// 		getDeclaredFields0M.setAccessible(true);
// 		Field[] fields = (Field[]) getDeclaredFields0M.invoke(Class.forName("jdk.internal.reflect.Reflection"), false);
// 		Field field = null;
// 		for (Field f : fields) {
// 			if (f.getName().equals(clazz.getSimpleName().toLowerCase() + "FilterMap")) {
// 				field = f;
// 			}
// 		}
// 		Method setAccessible0M = AccessibleObject.class.getDeclaredMethod("setAccessible0", boolean.class);
// 		setAccessible0M.setAccessible(true);
// 		setAccessible0M.invoke(field, true);
// 		return (Map<Class<?>, String[]>) field.get(null);
// 	}
// 
// }


// Path: src/main/java/lilypad/bukkit/connect/injector/HandlerListInjector.java
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import lilypad.bukkit.connect.util.ReflectionUtils;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredListener;

package lilypad.bukkit.connect.injector;




public class HandlerListInjector extends HandlerList {

	@SuppressWarnings("unchecked")
	public static void prioritize(Plugin plugin, Class<? extends Event> event) throws Exception {
		HandlerList handlerList = ReflectionUtils.getPrivateField(event, null, HandlerList.class, "handlers");