diff --git a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java index 398f196e6..4c94d4117 100644 --- a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java +++ b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java @@ -8,6 +8,7 @@ import us.myles.ViaVersion.ConnectionInfo; import us.myles.ViaVersion.transformers.IncomingTransformer; import us.myles.ViaVersion.util.PacketUtil; +import java.nio.channels.ClosedChannelException; import java.util.List; public class ViaDecodeHandler extends ByteToMessageDecoder { @@ -44,10 +45,12 @@ public class ViaDecodeHandler extends ByteToMessageDecoder { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - if (!(cause.getCause().getCause() instanceof CancelException)) { - if (!(cause.getCause() instanceof CancelException)) { - if (!(cause instanceof CancelException)) { - System.out.println("throwing"); + if (!(cause.getCause().getCause() instanceof CancelException) + && !(cause.getCause().getCause() instanceof ClosedChannelException)) { + if (!(cause.getCause() instanceof CancelException) + && !(cause.getCause() instanceof ClosedChannelException)) { + if (!(cause instanceof CancelException) + && !(cause instanceof ClosedChannelException)) { if (cause instanceof Exception) throw (Exception) cause; } diff --git a/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java b/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java index d78195a5b..a09aa26b3 100644 --- a/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java +++ b/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java @@ -10,6 +10,7 @@ import us.myles.ViaVersion.util.PacketUtil; import us.myles.ViaVersion.util.ReflectionUtil; import java.lang.reflect.Constructor; +import java.nio.channels.ClosedChannelException; public class ViaEncodeHandler extends MessageToByteEncoder { private final ConnectionInfo info; @@ -71,10 +72,12 @@ public class ViaEncodeHandler extends MessageToByteEncoder { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - if (!(cause.getCause().getCause() instanceof CancelException)) { - if (!(cause.getCause() instanceof CancelException)) { - if (!(cause instanceof CancelException)) { - System.out.println("throwing"); + if (!(cause.getCause().getCause() instanceof CancelException) + && !(cause.getCause().getCause() instanceof ClosedChannelException)) { + if (!(cause.getCause() instanceof CancelException) + && !(cause.getCause() instanceof ClosedChannelException)) { + if (!(cause instanceof CancelException) + && !(cause instanceof ClosedChannelException)) { if (cause instanceof Exception) throw (Exception) cause; }