3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Fix 1.19 -> 1.18.2 title translation: empty text edge case (#3115)

Dieser Commit ist enthalten in:
RK_01 2022-09-02 16:00:45 +02:00 committet von GitHub
Ursprung ce4f21b7d8
Commit c96b2bd859
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -120,7 +120,8 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
final PacketHandler titleHandler = wrapper -> { final PacketHandler titleHandler = wrapper -> {
final JsonElement component = wrapper.read(Type.COMPONENT); final JsonElement component = wrapper.read(Type.COMPONENT);
if (!component.isJsonNull()) { final boolean isEmpty = component.isJsonNull() || (component.isJsonArray() && component.getAsJsonArray().size() == 0);
if (!isEmpty) {
wrapper.write(Type.COMPONENT, component); wrapper.write(Type.COMPONENT, component);
} else { } else {
wrapper.write(Type.COMPONENT, GsonComponentSerializer.gson().serializeToTree(Component.empty())); wrapper.write(Type.COMPONENT, GsonComponentSerializer.gson().serializeToTree(Component.empty()));