From 42b7bb16d3bb7158a7bc713d8dfa34eabb78b7de Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 25 Apr 2024 07:26:05 +1000 Subject: [PATCH] Fix equality of deserialized display names By: md_5 --- .../java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 2 +- .../main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java | 2 +- 2 files changed, 2 insertions(+), 2 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 d3577d027b..6861111641 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 @@ -449,7 +449,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } CraftMetaItem(Map map) { - displayName = CraftChatMessage.fromJSONOrString(SerializableMeta.getString(map, NAME.BUKKIT, true)); + displayName = CraftChatMessage.fromJSONOrString(SerializableMeta.getString(map, NAME.BUKKIT, true), true, false); itemName = CraftChatMessage.fromJSONOrNull(SerializableMeta.getString(map, ITEM_NAME.BUKKIT, true)); Iterable lore = SerializableMeta.getObject(Iterable.class, map, LORE.BUKKIT, true); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java index bd53970d15..30cebceff2 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -221,7 +221,7 @@ public final class CraftChatMessage { return fromJSONOrString(message, false, keepNewlines); } - private static IChatBaseComponent fromJSONOrString(String message, boolean nullable, boolean keepNewlines) { + public static IChatBaseComponent fromJSONOrString(String message, boolean nullable, boolean keepNewlines) { if (message == null) message = ""; if (nullable && message.isEmpty()) return null; IChatBaseComponent component = fromJSONOrNull(message);