From 86b52ff6183f82a4c14c0f17303847942961b43c Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 24 Apr 2024 08:12:08 +1000 Subject: [PATCH] SPIGOT-7621: Fix empty strings in item lore By: md_5 --- .../org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index b0010737e9..235323cdb8 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1643,11 +1643,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { addTo.add(IChatBaseComponent.empty()); } else { String entry = object.toString(); + IChatBaseComponent component = (possiblyJsonInput) ? CraftChatMessage.fromJSONOrString(entry) : CraftChatMessage.fromStringOrNull(entry); - if (possiblyJsonInput) { - addTo.add(CraftChatMessage.fromJSONOrString(entry)); + if (component != null) { + addTo.add(component); } else { - addTo.add(CraftChatMessage.fromStringOrNull(entry)); + addTo.add(IChatBaseComponent.empty()); } } }