Chest serialization does not preserve ItemMeta data

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: None
    • Environment:

      Latest spigot build, java7, OS X

      If you serialize a chest with ItemMeta into yaml, save the config, reload the config, and finally retrieve it, the chest will have lost of of it's ItemMeta. Example chest "54:0 1 Unbreaking:1 name:&9Test_Chest lore:&5Serotahu"

      This plugin is the simplest to exhibit the bug https://github.com/pascoej/ItemSerializationBug

      Or if you run this code:

      saveDefaultConfig();
      ItemStack itemStack = new ItemStack(Material.CHEST);
      List<String> lore = new ArrayList<String>();
      lore.add("test");
      ItemMeta itemMeta = itemStack.getItemMeta();
      itemMeta.setLore(lore);
      itemStack.setItemMeta(itemMeta);
      System.out.println(itemStack.getItemMeta().getLore());
      getConfig().set("test-item",itemStack);
      saveConfig();
      reloadConfig();
      itemStack = getConfig().getItemStack("test-item");
      System.out.println(itemStack.getItemMeta().getLore());

      It outputs :
      [20:42:17 INFO]: [test]
      [20:42:17 INFO]: null

      Showing that the lore is not preserved.

            Assignee:
            Thinkofname
            Reporter:
            John Pascoe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: