// Path: Journey of Legends/aginsun/journey/universal/packets/PacketQuestDataClient.java
// public class PacketQuestDataClient extends PacketJoL
// {
// 	private String username;
// 	private String questName;
// 	private int questStatus;
// 	
// 	public PacketQuestDataClient() 
// 	{
// 		super(PacketType.QUESTDATACLIENT, false);
// 	}
// 	
// 	public PacketQuestDataClient(String username, String questName, int questStatus)
// 	{
// 		super(PacketType.QUESTDATACLIENT, false);
// 		this.username = username;
// 		this.questName = questName;
// 		this.questStatus = questStatus;
// 	}
// 	
// 	public void readData(DataInputStream data) throws IOException
// 	{
// 		this.username = data.readUTF();
// 		this.questName = data.readUTF();
// 		this.questStatus = data.readInt();
// 	}
// 	
// 	public void writeData(DataOutputStream dos) throws IOException
// 	{
// 		dos.writeUTF(username);
// 		dos.writeUTF(questName);
// 		dos.writeInt(questStatus);
// 	}
// 	
// 	public void execute(INetworkManager network, Player player)
// 	{
// 		EntityPlayer thePlayer = (EntityPlayer)player;
// 		
// 		QuestHandler.instance().setQuestStatusClient(thePlayer, questName, questStatus);
// 	}
// }
// 
// 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 java.util.HashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import aginsun.journey.universal.packets.PacketQuestDataClient;
import aginsun.journey.universal.packets.PacketType;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
package aginsun.journey.server.api;


/**
 * WIP: QuestHandler: 1 == QuestStarted, 2 == QuestFinished, 3 == QuestFinished + reward!
 * @author Aginsun
 */

public class QuestHandler
{
	private HashMap<String, NBTTagCompound> questList = new HashMap<String, NBTTagCompound>();
	private HashMap<String, HashMap<String, Integer>> questProgress = new HashMap<String, HashMap<String, Integer>>();
	private static QuestHandler instance = new QuestHandler();
	
	public QuestHandler(){}
	
	public static QuestHandler instance()
	{
		return instance;
	}
	
	public int getQuestStatus(EntityPlayer player, String QuestName)
	{
		NBTTagCompound nbt = getQuestPlayer(player);
		return nbt.getInteger(QuestName);
	}
	
	public void setQuestStatus(EntityPlayer player, String questName, int questStatus)
	{
		NBTTagCompound nbt = getQuestPlayer(player);
		nbt.setInteger(questName, questStatus);
// Path: Journey of Legends/aginsun/journey/universal/packets/PacketQuestDataClient.java
// public class PacketQuestDataClient extends PacketJoL
// {
// 	private String username;
// 	private String questName;
// 	private int questStatus;
// 	
// 	public PacketQuestDataClient() 
// 	{
// 		super(PacketType.QUESTDATACLIENT, false);
// 	}
// 	
// 	public PacketQuestDataClient(String username, String questName, int questStatus)
// 	{
// 		super(PacketType.QUESTDATACLIENT, false);
// 		this.username = username;
// 		this.questName = questName;
// 		this.questStatus = questStatus;
// 	}
// 	
// 	public void readData(DataInputStream data) throws IOException
// 	{
// 		this.username = data.readUTF();
// 		this.questName = data.readUTF();
// 		this.questStatus = data.readInt();
// 	}
// 	
// 	public void writeData(DataOutputStream dos) throws IOException
// 	{
// 		dos.writeUTF(username);
// 		dos.writeUTF(questName);
// 		dos.writeInt(questStatus);
// 	}
// 	
// 	public void execute(INetworkManager network, Player player)
// 	{
// 		EntityPlayer thePlayer = (EntityPlayer)player;
// 		
// 		QuestHandler.instance().setQuestStatusClient(thePlayer, questName, questStatus);
// 	}
// }
// 
// 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/server/api/QuestHandler.java
import java.util.HashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import aginsun.journey.universal.packets.PacketQuestDataClient;
import aginsun.journey.universal.packets.PacketType;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

package aginsun.journey.server.api;


/**
 * WIP: QuestHandler: 1 == QuestStarted, 2 == QuestFinished, 3 == QuestFinished + reward!
 * @author Aginsun
 */

public class QuestHandler
{
	private HashMap<String, NBTTagCompound> questList = new HashMap<String, NBTTagCompound>();
	private HashMap<String, HashMap<String, Integer>> questProgress = new HashMap<String, HashMap<String, Integer>>();
	private static QuestHandler instance = new QuestHandler();
	
	public QuestHandler(){}
	
	public static QuestHandler instance()
	{
		return instance;
	}
	
	public int getQuestStatus(EntityPlayer player, String QuestName)
	{
		NBTTagCompound nbt = getQuestPlayer(player);
		return nbt.getInteger(QuestName);
	}
	
	public void setQuestStatus(EntityPlayer player, String questName, int questStatus)
	{
		NBTTagCompound nbt = getQuestPlayer(player);
		nbt.setInteger(questName, questStatus);
		PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketQuestDataClient(player.username, questName, questStatus)), (Player)player);