-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
This server is running CraftBukkit version git-Spigot-a19903d-e1ebdd9 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)
-
Yes
- Create an ItemStack and set some boolean-like String value (e.g. testplugin:value: 'TRUE')
- Serialize it to YAML (the code below also saves it to a file because it's its main purpose)
- Deserizlize the ItemStack from the output code and the value has become 1b
public void onEnable() { File saveFile = new File(getDataFolder(), "test.yml"); try { FileConfiguration configuration = new YamlConfiguration(); ItemStack item = new ItemStack(Material.STONE); ItemMeta meta = item.getItemMeta(); meta.getPersistentDataContainer().set(new NamespacedKey(this, "value"), PersistentDataType.STRING, "TRUE"); item.setItemMeta(meta); configuration.set("item", item); configuration.save(saveFile); // SAVED getLogger().info(configuration.saveToString()); } catch (IOException e) { e.printStackTrace(); } try { FileConfiguration configuration = new YamlConfiguration(); configuration.load(saveFile); // LOADED getLogger().info(configuration.saveToString()); } catch (IOException | InvalidConfigurationException e) { e.printStackTrace(); } }
Output:
[20:34:51] [Server thread/INFO]: [TestPlugin] item:
==: org.bukkit.inventory.ItemStack
v: 2584
type: STONE
meta:
==: ItemMeta
meta-type: UNSPECIFIC
PublicBukkitValues:
testplugin:value: 'TRUE'
[20:34:51] [Server thread/INFO]: [TestPlugin] item:
==: org.bukkit.inventory.ItemStack
v: 2584
type: STONE
meta:
==: ItemMeta
meta-type: UNSPECIFIC
PublicBukkitValues:
testplugin:value: 1b