[SPIGOT-279] Chest serialization does not preserve ItemMeta data Created: 25/Dec/14  Updated: 27/Dec/14  Resolved: 27/Dec/14

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: John Pascoe Assignee: Thinkofname
Resolution: Fixed Votes: 0
Labels: serialization
Environment:

Latest spigot build, java7, OS X



 Description   

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.


Generated at Sat Apr 05 07:15:05 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.