package Data;

import java.util.List;

import engine.gridobject.person.Player;
import engine.item.Item;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;

public class WorldDataManager {
	public WorldDataManager() {}
	
	public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
		WorldData worldData = wd;

        if (worldData == null) {
        	return;
        }
		PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();		
		List<Weapon> wList = player.getWeaponList();
		String [] weaponListNames = new String[wList.size()];
		int wCounter = 0;
		for (Weapon wep : wList) {
			String wepName = wep.toString();
			weaponListNames[wCounter] = wepName;
			wCounter++;
		}
		List<Item> itemList = player.getItems();
		String [] itemListNames = new String[itemList.size()];
		int iCounter = 0;
		for (Item item : itemList) {
			String itemName = item.toString();
			itemListNames[iCounter] = itemName;
			iCounter++;
		}
		worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListNames);
		worldData.getMap(mapDataKey).getPlayData().setItems(itemListNames);
		DataManager dm = new DataManager();
		dm.setWorldData(fileName, worldData);
		dm.saveWorldDataToFile(fileName);
	}
	

}

package Data;

import java.util.List;

import engine.gridobject.person.Player;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;

public class WorldDataManager {
	public WorldDataManager() {}
	
	public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
		WorldData worldData = wd;

        if (worldData == null)	 {
        	System.out.println("worldData is null");
        }
		PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();		
		List<Weapon> wList = player.getWeaponList();
		System.out.println("weaponlist.size" + wList.size());
		String [] weaponListName = new String[wList.size()];
		int wCounter = 0;
		for (Weapon wep : wList) {
			String wepName = wep.toString();
			weaponListName[wCounter] = wepName;
			wCounter++;
		}
		
		worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListName);
		DataManager dm = new DataManager();
		dm.setWorldData(fileName, worldData);
		dm.saveWorldDataToFile(fileName);
	}
	

}

--- 
+++ 
@@ -3,6 +3,7 @@
 import java.util.List;
 
 import engine.gridobject.person.Player;
+import engine.item.Item;
 import engine.item.Weapon;
 import authoring.PlayerData;
 import authoring.WorldData;
@@ -13,21 +14,28 @@
 	public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
 		WorldData worldData = wd;
 
-        if (worldData == null)	 {
-        	System.out.println("worldData is null");
+        if (worldData == null) {
+        	return;
         }
 		PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();		
 		List<Weapon> wList = player.getWeaponList();
-		System.out.println("weaponlist.size" + wList.size());
-		String [] weaponListName = new String[wList.size()];
+		String [] weaponListNames = new String[wList.size()];
 		int wCounter = 0;
 		for (Weapon wep : wList) {
 			String wepName = wep.toString();
-			weaponListName[wCounter] = wepName;
+			weaponListNames[wCounter] = wepName;
 			wCounter++;
 		}
-		
-		worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListName);
+		List<Item> itemList = player.getItems();
+		String [] itemListNames = new String[itemList.size()];
+		int iCounter = 0;
+		for (Item item : itemList) {
+			String itemName = item.toString();
+			itemListNames[iCounter] = itemName;
+			iCounter++;
+		}
+		worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListNames);
+		worldData.getMap(mapDataKey).getPlayData().setItems(itemListNames);
 		DataManager dm = new DataManager();
 		dm.setWorldData(fileName, worldData);
 		dm.saveWorldDataToFile(fileName);
Save items and weapons in PlayerData
