Process motd description rgb colors

Fixes ViaVersion/ViaVersion#1999
This commit is contained in:
KennyTV 2020-08-16 10:50:22 +02:00
parent f387899dab
commit 03ec04cc8d
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -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() {