Skip to content

Commit

Permalink
Revert a tiny bit closer to vanilla
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Sep 19, 2024
1 parent fc868b6 commit 59fcdf1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ public void packetReceived(Session session, Packet packet) {
session.disconnect(loginDisconnectPacket.getReason());
} else if (packet instanceof ClientboundLoginCompressionPacket loginCompressionPacket) {
int threshold = loginCompressionPacket.getThreshold();
session.setCompression(threshold >= 0 ?
new CompressionConfig(threshold, new ZlibCompression(), false) : null);
if (threshold >= 0) {
session.setCompression(new CompressionConfig(threshold, new ZlibCompression(), false));
}
}
} else if (protocol.getInboundState() == ProtocolState.STATUS) {
if (packet instanceof ClientboundStatusResponsePacket statusResponsePacket) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ private void authenticate(Session session, boolean shouldAuthenticate, SecretKey
session.setFlag(MinecraftConstants.PROFILE_KEY, profile);

int threshold = session.getFlag(MinecraftConstants.SERVER_COMPRESSION_THRESHOLD, DEFAULT_COMPRESSION_THRESHOLD);
session.send(new ClientboundLoginCompressionPacket(threshold), () ->
session.setCompression(threshold >= 0 ?
new CompressionConfig(threshold, new ZlibCompression(), true) : null));
if (threshold >= 0) {
session.send(new ClientboundLoginCompressionPacket(threshold), () ->
session.setCompression(new CompressionConfig(threshold, new ZlibCompression(), true)));
}

session.send(new ClientboundGameProfilePacket(profile, true));
}
Expand Down

0 comments on commit 59fcdf1

Please sign in to comment.