// Path: Journey of Legends/aginsun/journey/universal/packets/PacketJoL.java
// public abstract class PacketJoL 
// {
// 	public PacketType packetType;
// 	public boolean isChunkDataPacket;
// 	
// 	public PacketJoL(PacketType packetType, boolean isChunkDataPacket)
// 	{
// 		this.packetType = packetType;
// 		this.isChunkDataPacket = isChunkDataPacket;
// 	}
// 	
// 	public byte[] populate()
// 	{
// 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
// 		DataOutputStream dos = new DataOutputStream(bos);
// 		
// 		try{
// 			dos.writeByte(packetType.ordinal());
// 			this.writeData(dos);
// 		}catch(IOException e){
// 			e.printStackTrace();
// 		}
// 		
// 		return bos.toByteArray();
// 	}
// 	
//     public void readPopulate(DataInputStream data) {
// 
//         try {
//             this.readData(data);
//         }
//         catch (IOException e) {
//             e.printStackTrace(System.err);
//         }
//     }
// 	
// 	public abstract void readData(DataInputStream data) throws IOException;
// 	
// 	public abstract void writeData(DataOutputStream dos) throws IOException;
// 	
// 	public abstract void execute(INetworkManager network, Player player);
// 	
// 	public void setKey(int key){}
// }
// 
// Path: Journey of Legends/aginsun/journey/universal/packets/PacketType.java
// public enum PacketType 
// {
// 	GOLD(PacketGold.class),
// 	EXPERIENCE(PacketExperience.class),
// 	STATS(PacketStatsClient.class),
// 	STATCHANGE(PacketStatChange.class),
// 	RACE(PacketRace.class), 
// 	QUESTDATA(PacketQuestData.class),
// 	QUESTDATACLIENT(PacketQuestDataClient.class),
// 	LEVEL(PacketLevel.class),
// 	SOUND(PacketSound.class);
// 	
// 	private Class<? extends PacketJoL> clazz;
// 	
// 	PacketType(Class<? extends PacketJoL> clazz)
// 	{
// 		this.clazz = clazz;
// 	}
// 	
//     public static PacketJoL buildPacket(byte[] data) {
// 
//         ByteArrayInputStream bis = new ByteArrayInputStream(data);
//         int selector = bis.read();
//         DataInputStream dis = new DataInputStream(bis);
// 
//         PacketJoL packet = null;
// 
//         try {
//             packet = values()[selector].clazz.newInstance();
//         }
//         catch (Exception e) {
//             e.printStackTrace(System.err);
//         }
// 
//         packet.readPopulate(dis);
// 
//         return packet;
//     }
// 
//     public static PacketJoL buildPacket(PacketType type) {
// 
//         PacketJoL packet = null;
// 
//         try {
//             packet = values()[type.ordinal()].clazz.newInstance();
//         }
//         catch (Exception e) {
//             e.printStackTrace(System.err);
//         }
// 
//         return packet;
//     }
// 
//     public static Packet populatePacket(PacketJoL packetToK) {
// 
//         byte[] data = packetToK.populate();
// 
//         Packet250CustomPayload packet250 = new Packet250CustomPayload();
//         packet250.channel = Utils.modID;
//         packet250.data = data;
//         packet250.length = data.length;
//         packet250.isChunkDataPacket = packetToK.isChunkDataPacket;
// 
//         return packet250;
//     }
// }


import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import aginsun.journey.universal.packets.PacketJoL;
import aginsun.journey.universal.packets.PacketType;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
package aginsun.journey.universal.handlers;


public class PacketHandler implements IPacketHandler
{
	@Override
	public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) 
	{
// Path: Journey of Legends/aginsun/journey/universal/packets/PacketJoL.java
// public abstract class PacketJoL 
// {
// 	public PacketType packetType;
// 	public boolean isChunkDataPacket;
// 	
// 	public PacketJoL(PacketType packetType, boolean isChunkDataPacket)
// 	{
// 		this.packetType = packetType;
// 		this.isChunkDataPacket = isChunkDataPacket;
// 	}
// 	
// 	public byte[] populate()
// 	{
// 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
// 		DataOutputStream dos = new DataOutputStream(bos);
// 		
// 		try{
// 			dos.writeByte(packetType.ordinal());
// 			this.writeData(dos);
// 		}catch(IOException e){
// 			e.printStackTrace();
// 		}
// 		
// 		return bos.toByteArray();
// 	}
// 	
//     public void readPopulate(DataInputStream data) {
// 
//         try {
//             this.readData(data);
//         }
//         catch (IOException e) {
//             e.printStackTrace(System.err);
//         }
//     }
// 	
// 	public abstract void readData(DataInputStream data) throws IOException;
// 	
// 	public abstract void writeData(DataOutputStream dos) throws IOException;
// 	
// 	public abstract void execute(INetworkManager network, Player player);
// 	
// 	public void setKey(int key){}
// }
// 
// Path: Journey of Legends/aginsun/journey/universal/packets/PacketType.java
// public enum PacketType 
// {
// 	GOLD(PacketGold.class),
// 	EXPERIENCE(PacketExperience.class),
// 	STATS(PacketStatsClient.class),
// 	STATCHANGE(PacketStatChange.class),
// 	RACE(PacketRace.class), 
// 	QUESTDATA(PacketQuestData.class),
// 	QUESTDATACLIENT(PacketQuestDataClient.class),
// 	LEVEL(PacketLevel.class),
// 	SOUND(PacketSound.class);
// 	
// 	private Class<? extends PacketJoL> clazz;
// 	
// 	PacketType(Class<? extends PacketJoL> clazz)
// 	{
// 		this.clazz = clazz;
// 	}
// 	
//     public static PacketJoL buildPacket(byte[] data) {
// 
//         ByteArrayInputStream bis = new ByteArrayInputStream(data);
//         int selector = bis.read();
//         DataInputStream dis = new DataInputStream(bis);
// 
//         PacketJoL packet = null;
// 
//         try {
//             packet = values()[selector].clazz.newInstance();
//         }
//         catch (Exception e) {
//             e.printStackTrace(System.err);
//         }
// 
//         packet.readPopulate(dis);
// 
//         return packet;
//     }
// 
//     public static PacketJoL buildPacket(PacketType type) {
// 
//         PacketJoL packet = null;
// 
//         try {
//             packet = values()[type.ordinal()].clazz.newInstance();
//         }
//         catch (Exception e) {
//             e.printStackTrace(System.err);
//         }
// 
//         return packet;
//     }
// 
//     public static Packet populatePacket(PacketJoL packetToK) {
// 
//         byte[] data = packetToK.populate();
// 
//         Packet250CustomPayload packet250 = new Packet250CustomPayload();
//         packet250.channel = Utils.modID;
//         packet250.data = data;
//         packet250.length = data.length;
//         packet250.isChunkDataPacket = packetToK.isChunkDataPacket;
// 
//         return packet250;
//     }
// }


// Path: Journey of Legends/aginsun/journey/universal/handlers/PacketHandler.java
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import aginsun.journey.universal.packets.PacketJoL;
import aginsun.journey.universal.packets.PacketType;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;

package aginsun.journey.universal.handlers;


public class PacketHandler implements IPacketHandler
{
	@Override
	public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) 
	{
		PacketJoL packetToK = PacketType.buildPacket(packet.data);