From 22c7769eae8d1dfb440897f3370bdde76f8a437c Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 27 Jul 2018 01:09:49 -0400 Subject: [PATCH] Fix compression support --- .../proxy/connection/MinecraftConnection.java | 2 -- .../proxy/connection/client/LoginSessionHandler.java | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index c54d27047..c839a2934 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -148,8 +148,6 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { } public void setCompressionThreshold(int threshold) { - channel.writeAndFlush(new SetCompression(threshold), channel.voidPromise()); - if (threshold == -1) { channel.pipeline().remove("compress-decoder"); channel.pipeline().remove("compress-encoder"); diff --git a/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java b/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java index e94d88fc3..03bb63598 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java +++ b/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java @@ -4,10 +4,7 @@ import com.google.common.base.Preconditions; import com.velocitypowered.proxy.data.GameProfile; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; -import com.velocitypowered.proxy.protocol.packets.EncryptionRequest; -import com.velocitypowered.proxy.protocol.packets.EncryptionResponse; -import com.velocitypowered.proxy.protocol.packets.ServerLogin; -import com.velocitypowered.proxy.protocol.packets.ServerLoginSuccess; +import com.velocitypowered.proxy.protocol.packets.*; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.VelocityServer; @@ -93,6 +90,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } private void handleSuccessfulLogin(GameProfile profile) { + inbound.write(new SetCompression(256)); inbound.setCompressionThreshold(256); ServerLoginSuccess success = new ServerLoginSuccess();