From 2e250d24b60b2abb82f62dcb50392c146f03ebab Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 25 Jul 2018 12:20:20 -0400 Subject: [PATCH] Fix compression --- .../velocity/protocol/netty/MinecraftCompressEncoder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressEncoder.java b/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressEncoder.java index 9696bc0be..3dfbed37f 100644 --- a/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressEncoder.java +++ b/src/main/java/io/minimum/minecraft/velocity/protocol/netty/MinecraftCompressEncoder.java @@ -26,8 +26,9 @@ public class MinecraftCompressEncoder extends MessageToByteEncoder { ByteBuf compressedBuffer = ctx.alloc().buffer(); try { + int uncompressed = msg.readableBytes(); compressor.deflate(msg, compressedBuffer); - ProtocolUtils.writeVarInt(out, msg.readableBytes()); + ProtocolUtils.writeVarInt(out, uncompressed); out.writeBytes(compressedBuffer); } finally { compressedBuffer.release();