3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Fix quotation marks appearing in mixed json arrays

Fixes #3572
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-12-10 10:58:44 +01:00
Ursprung ec2397472d
Commit 1656ad45a0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -408,7 +408,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
addComponentType(jsonObject, tag); addComponentType(jsonObject, tag);
return tag; return tag;
} else if (element.isJsonArray()) { } else if (element.isJsonArray()) {
return convertJsonArray(element); return convertJsonArray(element.getAsJsonArray());
} else if (element.isJsonPrimitive()) { } else if (element.isJsonPrimitive()) {
final JsonPrimitive primitive = element.getAsJsonPrimitive(); final JsonPrimitive primitive = element.getAsJsonPrimitive();
if (primitive.isString()) { if (primitive.isString()) {
@ -461,11 +461,11 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
} }
} }
private static ListTag convertJsonArray(final JsonElement element) { private static ListTag convertJsonArray(final JsonArray array) {
// TODO Number arrays? // TODO Number arrays?
final ListTag listTag = new ListTag(); final ListTag listTag = new ListTag();
boolean singleType = true; boolean singleType = true;
for (final JsonElement entry : element.getAsJsonArray()) { for (final JsonElement entry : array) {
final Tag convertedEntryTag = convertToTag(entry); final Tag convertedEntryTag = convertToTag(entry);
if (listTag.getElementType() != null && listTag.getElementType() != convertedEntryTag.getClass()) { if (listTag.getElementType() != null && listTag.getElementType() != convertedEntryTag.getClass()) {
singleType = false; singleType = false;
@ -482,7 +482,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
// Generally, vanilla-esque serializers should not produce this format, so it should be rare // Generally, vanilla-esque serializers should not produce this format, so it should be rare
// Lists are only used for lists of components ("extra" and "with") // Lists are only used for lists of components ("extra" and "with")
final ListTag processedListTag = new ListTag(); final ListTag processedListTag = new ListTag();
for (final JsonElement entry : element.getAsJsonArray()) { for (final JsonElement entry : array) {
final Tag convertedTag = convertToTag(entry); final Tag convertedTag = convertToTag(entry);
if (convertedTag instanceof CompoundTag) { if (convertedTag instanceof CompoundTag) {
processedListTag.add(convertedTag); processedListTag.add(convertedTag);
@ -496,7 +496,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
compoundTag.put("text", new StringTag()); compoundTag.put("text", new StringTag());
compoundTag.put("extra", convertedTag); compoundTag.put("extra", convertedTag);
} else { } else {
compoundTag.put("text", new StringTag(convertedTag.toString())); compoundTag.put("text", new StringTag(convertedTag.asRawString()));
} }
processedListTag.add(compoundTag); processedListTag.add(compoundTag);
} }

Datei anzeigen

@ -6,7 +6,7 @@ adventure = "4.14.0"
gson = "2.10.1" gson = "2.10.1"
fastutil = "8.5.12" fastutil = "8.5.12"
flare = "2.0.1" flare = "2.0.1"
vianbt = "3.2.1" vianbt = "3.3.0"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"