From 301e84d69834da2d9f811307d52f8dfe9aa4d026 Mon Sep 17 00:00:00 2001 From: Myles Date: Fri, 14 Oct 2016 23:02:11 +0100 Subject: [PATCH] Add json fixing to login disconnect #515 --- .../protocols/protocol1_9to1_8/Protocol1_9TO1_8.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9TO1_8.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9TO1_8.java index ed8a0e456..67c2dce6a 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9TO1_8.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/Protocol1_9TO1_8.java @@ -8,10 +8,12 @@ import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.platform.providers.ViaProviders; import us.myles.ViaVersion.api.protocol.Protocol; +import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.ValueTransformer; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.types.version.Metadata1_8Type; import us.myles.ViaVersion.api.type.types.version.MetadataList1_8Type; +import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.protocols.protocol1_9to1_8.packets.*; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.HandItemProvider; @@ -79,6 +81,15 @@ public class Protocol1_9TO1_8 extends Protocol { @Override protected void registerPackets() { + // Disconnect workaround (JSON!) + registerOutgoing(State.LOGIN, 0x00, 0x00, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.STRING, Protocol1_9TO1_8.FIX_JSON); // 0 - Reason + } + }); + + // Other Handlers SpawnPackets.register(this); InventoryPackets.register(this); EntityPackets.register(this);