// Path: src/main/java/lilypad/bukkit/connect/util/JavassistUtil.java
// public class JavassistUtil {
// 
// 	public static ClassPool getClassPool() {
// 		ClassPool classPool = ClassPool.getDefault();
// 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// 		if (classLoader instanceof URLClassLoader) {
// 			URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
// 			for (URL url : urlClassLoader.getURLs()) {
// 				try {
// 					// assume files
// 					String path = Paths.get(url.toURI()).toString();
// 					classPool.appendClassPath(path);
// 				} catch (Exception exception) {
// 					exception.printStackTrace();
// 				}
// 			}
// 		}
// 		return classPool;
// 	}
// 
// }


import com.mojang.authlib.GameProfile;
import javassist.*;
import javassist.bytecode.*;
import lilypad.bukkit.connect.util.JavassistUtil;
import java.lang.reflect.Field;
			if (field.getType() == fieldType) {
				field.setAccessible(true);
				return field;
			}
		}
		return null;
	}

	private static Class create(Object networkManager) throws Exception {
		Object originalLoginListener = null;
		packetListenerField = null;
		Field[] networkManagerFields = networkManager.getClass().getDeclaredFields();
		for (Field field : networkManagerFields) {
			if (field.getType().getSimpleName().equals("PacketListener")) {
				field.setAccessible(true);
				packetListenerField = field;
				originalLoginListener = field.get(networkManager);
				break;
			}
		}

		if (originalLoginListener == null) {
			throw new Exception("Could not find LoginListener in NetworkManager!");
		}
		if (!originalLoginListener.getClass().getSimpleName().equals("LoginListener")) {
			throw new Exception("Could not find LoginListener in NetworkManager, found instead " + originalLoginListener.getClass().getSimpleName() + "!");
		}
		loginListenerClass = originalLoginListener.getClass();
		profileField = findFieldOfType(loginListenerClass, GameProfile.class);

// Path: src/main/java/lilypad/bukkit/connect/util/JavassistUtil.java
// public class JavassistUtil {
// 
// 	public static ClassPool getClassPool() {
// 		ClassPool classPool = ClassPool.getDefault();
// 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// 		if (classLoader instanceof URLClassLoader) {
// 			URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
// 			for (URL url : urlClassLoader.getURLs()) {
// 				try {
// 					// assume files
// 					String path = Paths.get(url.toURI()).toString();
// 					classPool.appendClassPath(path);
// 				} catch (Exception exception) {
// 					exception.printStackTrace();
// 				}
// 			}
// 		}
// 		return classPool;
// 	}
// 
// }


// Path: src/main/java/lilypad/bukkit/connect/login/LoginListenerProxy.java
import com.mojang.authlib.GameProfile;
import javassist.*;
import javassist.bytecode.*;
import lilypad.bukkit.connect.util.JavassistUtil;
import java.lang.reflect.Field;

			if (field.getType() == fieldType) {
				field.setAccessible(true);
				return field;
			}
		}
		return null;
	}

	private static Class create(Object networkManager) throws Exception {
		Object originalLoginListener = null;
		packetListenerField = null;
		Field[] networkManagerFields = networkManager.getClass().getDeclaredFields();
		for (Field field : networkManagerFields) {
			if (field.getType().getSimpleName().equals("PacketListener")) {
				field.setAccessible(true);
				packetListenerField = field;
				originalLoginListener = field.get(networkManager);
				break;
			}
		}

		if (originalLoginListener == null) {
			throw new Exception("Could not find LoginListener in NetworkManager!");
		}
		if (!originalLoginListener.getClass().getSimpleName().equals("LoginListener")) {
			throw new Exception("Could not find LoginListener in NetworkManager, found instead " + originalLoginListener.getClass().getSimpleName() + "!");
		}
		loginListenerClass = originalLoginListener.getClass();
		profileField = findFieldOfType(loginListenerClass, GameProfile.class);

		ClassPool classPool = JavassistUtil.getClassPool();