Fix compression support

This commit is contained in:
Andrew Steinborn
2018-07-27 01:09:49 -04:00
parent fc5b0d3577
commit 22c7769eae
2 changed files with 2 additions and 6 deletions

View File

@@ -148,8 +148,6 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
} }
public void setCompressionThreshold(int threshold) { public void setCompressionThreshold(int threshold) {
channel.writeAndFlush(new SetCompression(threshold), channel.voidPromise());
if (threshold == -1) { if (threshold == -1) {
channel.pipeline().remove("compress-decoder"); channel.pipeline().remove("compress-decoder");
channel.pipeline().remove("compress-encoder"); channel.pipeline().remove("compress-encoder");

View File

@@ -4,10 +4,7 @@ import com.google.common.base.Preconditions;
import com.velocitypowered.proxy.data.GameProfile; import com.velocitypowered.proxy.data.GameProfile;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packets.EncryptionRequest; import com.velocitypowered.proxy.protocol.packets.*;
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.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
@@ -93,6 +90,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
} }
private void handleSuccessfulLogin(GameProfile profile) { private void handleSuccessfulLogin(GameProfile profile) {
inbound.write(new SetCompression(256));
inbound.setCompressionThreshold(256); inbound.setCompressionThreshold(256);
ServerLoginSuccess success = new ServerLoginSuccess(); ServerLoginSuccess success = new ServerLoginSuccess();