mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
SPIGOT-7625: ItemStack with lore cannot be serialized in 1.20.5
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
ad5b07669d
commit
e190aa6b33
1 changed files with 9 additions and 2 deletions
|
@ -1481,8 +1481,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
builder.put(ITEM_NAME.BUKKIT, CraftChatMessage.toJSON(itemName));
|
builder.put(ITEM_NAME.BUKKIT, CraftChatMessage.toJSON(itemName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lore != null) {
|
if (hasLore()) {
|
||||||
builder.put(LORE.BUKKIT, ImmutableList.copyOf(lore));
|
// SPIGOT-7625: Convert lore to json before serializing it
|
||||||
|
List<String> jsonLore = new ArrayList<>();
|
||||||
|
|
||||||
|
for (IChatBaseComponent component : lore) {
|
||||||
|
jsonLore.add(CraftChatMessage.toJSON(component));
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.put(LORE.BUKKIT, jsonLore);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasCustomModelData()) {
|
if (hasCustomModelData()) {
|
||||||
|
|
Loading…
Reference in a new issue