diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java index 1145b8eae9..7849935432 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java @@ -43,7 +43,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java index 3d800a9a77..3c6bf544d7 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java @@ -52,7 +52,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { return; } - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { if (flagAndAlert() && setback) { setback = false; diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java index e83dc97db6..dd6a157f7d 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java @@ -50,7 +50,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java index ee96977935..f6ecdb06ec 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java @@ -58,7 +58,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java index 782302c1cf..212760d032 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java @@ -40,7 +40,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java index af6c32511f..1c9de80724 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java @@ -109,7 +109,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { setbackIfAboveSetbackVL(); setback = false; } - } else if (player.isTickingReliablyFor(3)) { + } else if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (String verbose : flags) { if (flagAndAlert(verbose) && setback) { setbackIfAboveSetbackVL(); diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java index 92e4533cc6..bbe57054a1 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java @@ -38,7 +38,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java index d607ff35f2..5462f9b158 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java @@ -53,7 +53,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (String verbose : flags) { flagAndAlert(verbose); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java index 1e697e1e16..634bd5bc67 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java @@ -53,7 +53,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (String verbose : flags) { flagAndAlert(verbose); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java index 9a57f2dbf3..462e24e712 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java @@ -60,7 +60,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderN.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderN.java index 990cd9646d..c36e737ef3 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderN.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderN.java @@ -57,7 +57,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { // we don't need to check pre-1.9 players here (no tick skipping) if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return; - if (player.isTickingReliablyFor(3)) { + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { flagAndAlert(); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java index 2ff16f5d46..295125facb 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java @@ -3,11 +3,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.PostPredictionCheck; import ac.grim.grimac.player.GrimPlayer; -import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; -import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon; -import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.protocol.world.BlockFace; import com.github.retrooper.packetevents.wrapper.play.client.*; import lombok.Getter; @@ -41,7 +38,7 @@ public PacketOrderProcessor(final GrimPlayer player) { @Override public void onPacketReceive(PacketReceiveEvent event) { - final PacketTypeCommon packetType = event.getPacketType(); + final var packetType = event.getPacketType(); if (packetType == PacketType.Play.Client.CLIENT_STATUS) { if (new WrapperPlayClientClientStatus(event).getAction() == WrapperPlayClientClientStatus.Action.OPEN_INVENTORY_ACHIEVEMENT) { @@ -106,40 +103,29 @@ public void onPacketReceive(PacketReceiveEvent event) { closingInventory = true; } - if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8) && !player.packetStateData.lastPacketWasTeleport) { - onTick(); + if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && !player.packetStateData.lastPacketWasTeleport && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) { + openingInventory = false; + swapping = false; + dropping = false; + attacking = false; + interacting = false; + releasing = false; + digging = false; + placing = false; + using = false; + picking = false; + sprinting = false; + sneaking = false; + clickingInInventory = false; + closingInventory = false; + quickMoveClicking = false; + pickUpClicking = false; + leavingBed = false; + startingToGlide = false; + jumpingWithMount = false; } } - @Override - public void onPredictionComplete(PredictionComplete predictionComplete) { - if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) { - onTick(); - } - } - - private void onTick() { - openingInventory = false; - swapping = false; - dropping = false; - attacking = false; - interacting = false; - releasing = false; - digging = false; - placing = false; - using = false; - picking = false; - sprinting = false; - sneaking = false; - clickingInInventory = false; - closingInventory = false; - quickMoveClicking = false; - pickUpClicking = false; - leavingBed = false; - startingToGlide = false; - jumpingWithMount = false; - } - @Contract(pure = true) public boolean isRightClicking() { return placing || using || interacting; diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 55bf12dbd6..912c5699ae 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -67,6 +67,7 @@ public class CheckManager { public CheckManager(GrimPlayer player) { // Include post checks in the packet check too packetChecks = new ImmutableClassToInstanceMap.Builder() + .put(PacketOrderProcessor.class, player.packetOrderProcessor) .put(Reach.class, new Reach(player)) .put(PacketEntityReplication.class, new PacketEntityReplication(player)) .put(PacketChangeGameState.class, new PacketChangeGameState(player)) @@ -129,7 +130,6 @@ public CheckManager(GrimPlayer player) { .put(KnockbackHandler.class, new KnockbackHandler(player)) .put(GhostBlockDetector.class, new GhostBlockDetector(player)) .put(Phase.class, new Phase(player)) - .put(PacketOrderProcessor.class, player.packetOrderProcessor) .put(Post.class, new Post(player)) .put(PacketOrderA.class, new PacketOrderA(player)) .put(PacketOrderE.class, new PacketOrderE(player))