[SPIGOT-6303] Itemstack serialization bug (lines missing from lore) Created: 01/Jan/21  Updated: 02/Jan/21  Resolved: 02/Jan/21

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

Type: Bug Priority: Major
Reporter: steve Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

1.16.4


Version: 1.16.4
Guidelines Read: Yes

 Description   

Itemstacks serialized in yaml before:
==: org.bukkit.inventory.ItemStack
{{ v: 2584}}
{{ type: DIAMOND_BOOTS}}
{{ meta:}}
{{ ==: ItemMeta}}
{{ meta-type: UNSPECIFIC}}
{{ display-name: 'Jump Boots'}}
{{ lore:}}
{{ - 'Increases Jump'}}
{{ - 'Increases Speed'}}
{{ - ''}}
{{ - 'Jumps: 10'}}
{{ enchants:}}
{{ PROTECTION_ENVIRONMENTAL: 5}}
{{ DURABILITY: 5}}

Itemstacks now:
==: org.bukkit.inventory.ItemStack
{{ v: 2584}}
{{ type: DIAMOND_BOOTS}}
{{ meta:}}
{{ ==: ItemMeta}}
{{ meta-type: UNSPECIFIC}}
{{ _display-name: '{"extra":[}}

{{

{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"Jump Boots"}

}}

],"text":""}'_
{{ lore:}}
{{ _- '{"extra":[}}

{{

{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"Increases Jump"}

}}

],"text":""}'_
{{ _- '{"extra":[}}

{{

{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"Increases Speed}

}}

],"text":""}'_
{{ - ''}}
{{ _- '{"extra":[}}

{{

{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"Jumps: 10"}

}}

],"text":""}'_
enchants:
PROTECTION_ENVIRONMENTAL: 5
DURABILITY: 5

This wouldn't be a problem except that the line break "- ''" isn't read and results in the line break being removed when loaded. Please convert all - '' lines to - '{"text":""}' to fix this.



 Comments   
Comment by blablubbabc [ 02/Jan/21 ]

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/780/

Comment by blablubbabc [ 02/Jan/21 ]

Apparently Gson parses empty Strings as null instead of throwing an parse exception (https://github.com/google/gson/blob/master/gson/src/main/java/com/google/gson/internal/Streams.java#L55), so this will need to be specifically checked by us. Currently we only react to parse exceptions and otherwise assume that the parsing was successful. PR is on the way.

Comment by steve [ 02/Jan/21 ]

I wrote a plugin to fix this by replacing null lore basecomponents with empty basecomponents, sorry for the trouble

Comment by Phoenix616 [ 02/Jan/21 ]

@steve could you provide that in a code block so that the yaml formatting is preserved?

Comment by md_5 [ 01/Jan/21 ]

blablubbabc

> After the 1.16 lore screw up you think a lesson would have been learned, i guess not.

We're trying our absolute best to fix what is an extremely complicated and suboptimal system. Unless you have something useful to contribute the commentary isn't necesssary, helpful, or welcome.

Generated at Sat Dec 13 15:25:26 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.