From 02c30078463394abe459f6d7f98d3721491659c3 Mon Sep 17 00:00:00 2001 From: AoElite <20812471+AoElite@users.noreply.github.com> Date: Mon, 1 Jan 2024 03:29:53 -0500 Subject: [PATCH] small optimization --- src/main/java/ac/grim/grimac/player/GrimPlayer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index ba95402c36..da3c6bb012 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -367,7 +367,6 @@ public void sendTransaction(boolean async) { lastTransSent = System.currentTimeMillis(); short transactionID = (short) (-1 * (transactionIDCounter.getAndIncrement() & 0x7FFF)); try { - addTransactionSend(transactionID); PacketWrapper packet; if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17)) { @@ -377,8 +376,12 @@ public void sendTransaction(boolean async) { } if (async) { - ChannelHelper.runInEventLoop(user.getChannel(), () -> user.writePacket(packet)); + ChannelHelper.runInEventLoop(user.getChannel(), () -> { + addTransactionSend(transactionID); + user.writePacket(packet); + }); } else { + addTransactionSend(transactionID); user.writePacket(packet); } } catch (