fix packethandler

This commit is contained in:
Beaness 2022-07-07 22:27:31 +02:00
parent dbbd6c3f3c
commit 0d4fcf4a97
2 changed files with 15 additions and 13 deletions

View File

@ -16,6 +16,8 @@ import io.netty.util.AttributeKey;
import io.netty.util.concurrent.AbstractEventExecutor; import io.netty.util.concurrent.AbstractEventExecutor;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener; import io.netty.util.concurrent.GenericFutureListener;
import java.lang.reflect.Method;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -163,28 +165,26 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception { protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception {
if (this.channel.isOpen()) { if (this.channel.isOpen()) {
try { try {
packet.a(this.m);
if (this.m instanceof PlayerConnection) { if (this.m instanceof PlayerConnection) {
//ImHacking Start
for (PacketHandler handler : eSpigot.getInstance().getCancellablePacketHandlers()) {
try {
if (!handler.handleReceivedPacketCancellable((PlayerConnection) this.m, packet)) {
return;
}
} catch (Exception e) {
e.printStackTrace();
}
}
//ImHacking End
try { try {
for (PacketHandler handler : eSpigot.getInstance().getPacketHandlers()) { for (PacketHandler handler : eSpigot.getInstance().getPacketHandlers()) {
handler.handleReceivedPacket((PlayerConnection) this.m, packet); handler.handleReceivedPacket((PlayerConnection) this.m, packet);
} }
for (PacketHandler handler : eSpigot.getInstance().getCancellablePacketHandlers()) {
try {
if (!handler.handleReceivedPacketCancellable((PlayerConnection) this.m, packet)) {
return;
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
packet.a(this.m);
} catch (CancelledPacketHandleException ignored) { } catch (CancelledPacketHandleException ignored) {
} }
} }

2
gradle.properties Normal file
View File

@ -0,0 +1,2 @@
org.gradle.parallel=true
org.gradle.daemon=true