From d3fde8025a391c41c120be74705978352ede8e25 Mon Sep 17 00:00:00 2001 From: ManInMyVan <113963219+ManInMyVan@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:31:56 -0700 Subject: [PATCH] fix MultiActionsC false with server opened inventories --- .../checks/impl/multiactions/MultiActionsC.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java index f23dab2e99..32f6320036 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java @@ -5,6 +5,7 @@ import ac.grim.grimac.checks.type.PacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; +import com.github.retrooper.packetevents.event.PacketSendEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "MultiActionsC", experimental = true) @@ -13,10 +14,12 @@ public MultiActionsC(GrimPlayer player) { super(player); } + private boolean serverOpenedInventoryThisTick; + @Override public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW) { - String verbose = player.isSprinting && !player.isSwimming ? "sprinting" : ""; + String verbose = player.isSprinting && !player.isSwimming && !serverOpenedInventoryThisTick ? "sprinting" : ""; if (player.packetStateData.isSlowedByUsingItem()) { verbose += (verbose.isEmpty() ? "" : ", ") + "using"; @@ -27,5 +30,16 @@ public void onPacketReceive(PacketReceiveEvent event) { player.onPacketCancel(); } } + + if (isTickPacket(event.getPacketType())) { + serverOpenedInventoryThisTick = false; + } + } + + @Override + public void onPacketSend(PacketSendEvent event) { + if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) { + player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> serverOpenedInventoryThisTick = true); + } } }