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

Process motd description rgb colors

Fixes ViaVersion/ViaVersion#1999
Dieser Commit ist enthalten in:
KennyTV 2020-08-16 10:50:22 +02:00
Ursprung f387899dab
Commit 03ec04cc8d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -23,6 +23,8 @@ import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.ViaVersion.util.GsonUtil;
import us.myles.viaversion.libs.gson.JsonObject;
import java.util.UUID; import java.util.UUID;
@ -51,6 +53,21 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
EntityPackets1_16 entityPackets = new EntityPackets1_16(this); EntityPackets1_16 entityPackets = new EntityPackets1_16(this);
entityPackets.register(); entityPackets.register();
registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
String original = wrapper.passthrough(Type.STRING);
JsonObject object = GsonUtil.getGson().fromJson(original, JsonObject.class);
JsonObject description = object.getAsJsonObject("description");
if (description == null) return;
translatableRewriter.processText(description);
wrapper.set(Type.STRING, 0, object.toString());
});
}
});
registerOutgoing(ClientboundPackets1_16.CHAT_MESSAGE, new PacketRemapper() { registerOutgoing(ClientboundPackets1_16.CHAT_MESSAGE, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {