mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 11:24:57 -05:00
Properly iterate through parents
This commit is contained in:
parent
6507e77bbe
commit
4e2b64d983
2 changed files with 17 additions and 1 deletions
|
@ -0,0 +1,15 @@
|
|||
package org.geysermc.mcprotocollib.network.helper;
|
||||
|
||||
public class PipelineHelper {
|
||||
public static boolean containsCause(Throwable t, Class<?> c) {
|
||||
do {
|
||||
if (c.isAssignableFrom(t.getClass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
t = t.getCause();
|
||||
} while (t != null);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import org.geysermc.mcprotocollib.network.event.session.DisconnectingEvent;
|
|||
import org.geysermc.mcprotocollib.network.event.session.PacketSendingEvent;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionEvent;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.helper.PipelineHelper;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.packet.PacketCancelException;
|
||||
import org.geysermc.mcprotocollib.network.packet.PacketProtocol;
|
||||
|
@ -316,7 +317,7 @@ public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> imp
|
|||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
if (cause instanceof PacketCancelException) {
|
||||
if (PipelineHelper.containsCause(cause, PacketCancelException.class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue