package projectzombie.inventory;

import projectzombie.util.ClassBdf;
import projectzombie.util.ItemStack;
import bdf.types.BdfNamedList;
import bdf.types.BdfObject;

public class InventoryArmor implements ClassBdf, IInventoryArmor
{
	private ItemStack helmet, chest, leggings;
	
	public InventoryArmor() {
		helmet = ItemStack.getEmpty();
		chest = ItemStack.getEmpty();
		leggings = ItemStack.getEmpty();
	}
	
	public InventoryArmor(BdfObject bdf) {
		BdfClassLoad(bdf);
	}

	@Override
	public ItemStack getHelmet() {
		return helmet;
	}

	@Override
	public ItemStack getChest() {
		return chest;
	}

	@Override
	public ItemStack getLeggings() {
		return leggings;
	}
	
	@Override
	public void setHelmet(ItemStack stack) {
		helmet = stack;
	}

	@Override
	public void setChest(ItemStack stack) {
		chest = stack;
	}

	@Override
	public void setLeggings(ItemStack stack) {
		leggings = stack;
	}

	@Override
	public void BdfClassLoad(BdfObject bdf) {
		BdfNamedList nl = bdf.getNamedList();
		helmet = new ItemStack(nl.get("helmet"));
		chest = new ItemStack(nl.get("chest"));
		leggings = new ItemStack(nl.get("leggings"));
	}

	@Override
	public void BdfClassSave(BdfObject bdf) {
		BdfNamedList nl = bdf.newNamedList();
		helmet.BdfClassSave(nl.get("helmet"));
		chest.BdfClassSave(nl.get("chest"));
		leggings.BdfClassSave(nl.get("leggings"));
		bdf.setNamedList(nl);
	}

}
