public static String InventoryToString (Inventory invInventory)
    {
        String serialization = invInventory.getSize() + ";";
        for (int i = 0; i < invInventory.getSize(); i++)
        {
            ItemStack is = invInventory.getItem(i);
            if (is != null)
            {
                String serializedItemStack = new String();
               
                String isType = String.valueOf(is.getType().getId());
                serializedItemStack += "t@" + isType;
               
                if (is.getDurability() != 0)
                {
                    String isDurability = String.valueOf(is.getDurability());
                    serializedItemStack += ":d@" + isDurability;
                }
               
                if (is.getAmount() != 1)
                {
                    String isAmount = String.valueOf(is.getAmount());
                    serializedItemStack += ":a@" + isAmount;
                }
               
                Map<Enchantment,Integer> isEnch = is.getEnchantments();
                if (isEnch.size() > 0)
                {
                    for (Entry<Enchantment,Integer> ench : isEnch.entrySet())
                    {
                        serializedItemStack += ":e@" + ench.getKey().getId() + "@" + ench.getValue();
                    }
                }
                
                if (is.getItemMeta().getDisplayName() != null)
                {
                	 String[] itemDisplayName = is.getItemMeta().getDisplayName().split(" ");
                     serializedItemStack += ":n@";
                     for (int m = 0; m < itemDisplayName.length; m++)
                     {
                    	 serializedItemStack += itemDisplayName[m] + "=";
                     }
                }
      
               
                serialization += i + "#" + serializedItemStack + ";";
            }
        }
        return serialization;
    }