3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Fix motd reading in some cases

Fixes #1826
Dieser Commit ist enthalten in:
KennyTV 2020-06-23 23:33:59 +02:00
Ursprung f671a4fa5c
Commit 5b807a9f17
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -62,7 +62,7 @@ public class Protocol1_16To1_15_2 extends Protocol<ClientboundPackets1_15, Clien
@Override
public void registerMap() {
handler(wrapper -> {
String original = wrapper.read(Type.STRING);
String original = wrapper.passthrough(Type.STRING);
JsonObject object = GsonUtil.getGson().fromJson(original, JsonObject.class);
JsonObject players = object.getAsJsonObject("players");
if (players == null) return;
@ -88,11 +88,10 @@ public class Protocol1_16To1_15_2 extends Protocol<ClientboundPackets1_15, Clien
}
}
// Replace data if changed
if (splitSamples.size() != sample.size()) {
players.add("sample", splitSamples);
wrapper.write(Type.STRING, object.toString());
} else {
wrapper.write(Type.STRING, original);
wrapper.set(Type.STRING, 0, object.toString());
}
});
}