Properly unescape displayname & lore

This commit is contained in:
TheMode 2021-06-06 14:21:25 +02:00
parent aee429add3
commit 3e73ec5646

View File

@ -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<NBTString> loreList = display.getList("Lore");
List<Component> 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);
}