Check if the channel is open in BukkitEncodeHandler

This commit is contained in:
Nassim Jahnke 2024-03-02 20:13:58 +01:00
parent 04e572fa30
commit 8edad67394
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
1 changed files with 2 additions and 1 deletions

View File

@ -43,7 +43,8 @@ public final class BukkitEncodeHandler extends MessageToMessageEncoder<ByteBuf>
@Override
protected void encode(final ChannelHandlerContext ctx, final ByteBuf bytebuf, final List<Object> 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()) {