don't enforce async calls for thread-safe listeners (#1555)

closes #1551
This commit is contained in:
Pasqual Koschmieder 2022-03-26 18:00:22 +01:00 committed by GitHub
parent 4096952c16
commit c87604cf0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -503,15 +503,6 @@ public class NettyChannelInjector implements Injector {
return null;
}
// ensure that we're not on the main thread if we don't need to
if (!this.channelListener.hasMainThreadListener(packet.getClass()) && this.server.isPrimaryThread()) {
// re-schedule async
this.server.getScheduler().runTaskAsynchronously(
this.injectionFactory.getPlugin(),
() -> this.sendServerPacket(packet, null, false));
return null;
}
// call all listeners which are listening to the outbound packet, if any
// null indicates that no listener was affected by the packet, meaning that we can directly send the original packet
PacketEvent event = this.channelListener.onPacketSending(this, packet, marker);