From e9d76cc742333a62d9c0360086691d847ea2b648 Mon Sep 17 00:00:00 2001 From: themode Date: Fri, 26 Mar 2021 08:37:47 +0100 Subject: [PATCH] Flush in netty event loop --- .../server/network/player/NettyPlayerConnection.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/network/player/NettyPlayerConnection.java b/src/main/java/net/minestom/server/network/player/NettyPlayerConnection.java index 7581d3160..e3c0d28d2 100644 --- a/src/main/java/net/minestom/server/network/player/NettyPlayerConnection.java +++ b/src/main/java/net/minestom/server/network/player/NettyPlayerConnection.java @@ -71,10 +71,12 @@ public class NettyPlayerConnection extends PlayerConnection { @Override public void update() { // Flush - if (channel.isActive()) { - writeWaitingPackets(); - this.channel.flush(); - } + this.channel.eventLoop().submit(() -> { + if (channel.isActive()) { + writeWaitingPackets(); + this.channel.flush(); + } + }); // Network stats super.update(); }