From 12c049709a8274c17705f9a7a0d1e99a293bb250 Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Mon, 21 Oct 2019 03:16:02 -0800 Subject: [PATCH] Fix item nbt translator Mineplex server seemed to be sensitive about quotes in string tags --- .../connector/network/translators/item/ItemTranslator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index f60b56f79..071ab75d1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -91,6 +91,7 @@ public class ItemTranslator { private CompoundTag translateToJavaNBT(com.nukkitx.nbt.tag.CompoundTag tag) { CompoundTag javaTag = new CompoundTag(tag.getName()); + Map javaValue = javaTag.getValue(); if (tag.getValue() != null && !tag.getValue().isEmpty()) { for (String str : tag.getValue().keySet()) { com.nukkitx.nbt.tag.Tag bedrockTag = tag.get(str); @@ -98,10 +99,11 @@ public class ItemTranslator { if (translatedTag == null) continue; - javaTag.getValue().put(str, translatedTag); + javaValue.put(str, translatedTag); } } + javaTag.setValue(javaValue); return javaTag; } @@ -153,7 +155,7 @@ public class ItemTranslator { if (tag instanceof com.nukkitx.nbt.tag.StringTag) { com.nukkitx.nbt.tag.StringTag stringTag = (com.nukkitx.nbt.tag.StringTag) tag; - return new StringTag(stringTag.getName(), stringTag.getValue()); + return new StringTag(stringTag.getName(), '"' + stringTag.getValue() + '"'); } if (tag instanceof com.nukkitx.nbt.tag.ListTag) {