From 8edad673948aeafd78cfbb533f88cce9b822eae6 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 2 Mar 2024 20:13:58 +0100 Subject: [PATCH] Check if the channel is open in BukkitEncodeHandler --- .../viaversion/bukkit/handlers/BukkitEncodeHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitEncodeHandler.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitEncodeHandler.java index 7ecfcb2fd..1147ad407 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitEncodeHandler.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitEncodeHandler.java @@ -43,7 +43,8 @@ public final class BukkitEncodeHandler extends MessageToMessageEncoder @Override protected void encode(final ChannelHandlerContext ctx, final ByteBuf bytebuf, final List out) throws Exception { - if (!connection.checkClientboundPacket()) { + // Check if the channel is open as older servers might start sending packets through the pipeline despite the channel being closed + if (!connection.checkClientboundPacket() || !ctx.channel().isOpen()) { throw CancelEncoderException.generate(null); } if (!connection.shouldTransformPacket()) {