From 3e73ec56468fe842affade6ec7ec3fef0c528199 Mon Sep 17 00:00:00 2001 From: TheMode Date: Sun, 6 Jun 2021 14:21:25 +0200 Subject: [PATCH] Properly unescape displayname & lore --- src/main/java/net/minestom/server/utils/NBTUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/utils/NBTUtils.java b/src/main/java/net/minestom/server/utils/NBTUtils.java index a69922ee3..87b09e27c 100644 --- a/src/main/java/net/minestom/server/utils/NBTUtils.java +++ b/src/main/java/net/minestom/server/utils/NBTUtils.java @@ -149,7 +149,7 @@ public final class NBTUtils { if (nbt.containsKey("display")) { final NBTCompound display = nbt.getCompound("display"); if (display.containsKey("Name")) { - final String rawName = display.getString("Name"); + final String rawName = StringUtils.unescapeJavaString(display.getString("Name")); final Component displayName = GsonComponentSerializer.gson().deserialize(rawName); metaBuilder.displayName(displayName); } @@ -157,7 +157,8 @@ public final class NBTUtils { NBTList loreList = display.getList("Lore"); List lore = new ArrayList<>(); for (NBTString s : loreList) { - lore.add(GsonComponentSerializer.gson().deserialize(s.getValue())); + final String rawLore = StringUtils.unescapeJavaString(s.getValue()); + lore.add(GsonComponentSerializer.gson().deserialize(rawLore)); } metaBuilder.lore(lore); }