private Item readItem() throws IOException, SocketClosedException {
		Entities object = Entities.values()[readFromSocket()];
		//read object-specific values
		if(object==Entities.KEY) {
			int id = readFromSocket();
			String description = readString();
			return new Key(description, id);
		} else if(object==Entities.BAG) {
			Bag bag = new Bag();
			int numItems = readFromSocket();
			for(int i=0;i<numItems;i++) {
				bag.addItem(readItem());
			}
			return bag;
		} else if(object==Entities.BLUEFLAG) {
			return new Flag(Team.BLUE);
		} else if(object==Entities.REDFLAG) {
			return new Flag(Team.RED);
		} else if(object==Entities.POWERUP) {
			Power p = Power.values()[readFromSocket()];
			return new Powerup(p);
		} else if (object==Entities.HEALTH) {
			Power p = Power.values()[readFromSocket()];
			return new Powerup(p);
		} else {
			System.out.println("Invalid item recieved! "+object);
		}
		return null;
	}