diff --git a/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java b/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java index eeb5602abe..52da60283d 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java +++ b/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java @@ -59,15 +59,15 @@ public void process(final RotationUpdate rotationUpdate) { if (this.xRotMode.size() > SIGNIFICANT_SAMPLES_THRESHOLD) { Pair modeX = this.xRotMode.getMode(); - if (modeX.getSecond() > SIGNIFICANT_SAMPLES_THRESHOLD) { - this.modeX = modeX.getFirst(); + if (modeX.second() > SIGNIFICANT_SAMPLES_THRESHOLD) { + this.modeX = modeX.first(); this.sensitivityX = convertToSensitivity(this.modeX); } } if (this.yRotMode.size() > SIGNIFICANT_SAMPLES_THRESHOLD) { Pair modeY = this.yRotMode.getMode(); - if (modeY.getSecond() > SIGNIFICANT_SAMPLES_THRESHOLD) { - this.modeY = modeY.getFirst(); + if (modeY.second() > SIGNIFICANT_SAMPLES_THRESHOLD) { + this.modeY = modeY.first(); this.sensitivityY = convertToSensitivity(this.modeY); } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java index d538ac600c..ab7b79760a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java @@ -39,7 +39,7 @@ public void onPacketReceive(PacketReceiveEvent event) { boolean hasID = false; for (Pair iterator : keepaliveMap) { - if (iterator.getFirst() == id) { + if (iterator.first() == id) { hasID = true; break; } @@ -55,7 +55,7 @@ public void onPacketReceive(PacketReceiveEvent event) { do { data = keepaliveMap.poll(); if (data == null) break; - } while (data.getFirst() != id); + } while (data.first() != id); } } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java index 9692d9fae7..ad7e88ec61 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java @@ -6,6 +6,7 @@ import ac.grim.grimac.checks.type.BlockBreakCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockBreak; +import ac.grim.grimac.utils.change.BlockModification; import com.github.retrooper.packetevents.protocol.item.type.ItemTypes; import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.DiggingAction; @@ -13,6 +14,10 @@ import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes; import com.github.retrooper.packetevents.util.Vector3i; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + @CheckData(name = "BadPacketsX") public class BadPacketsX extends Check implements BlockBreakCheck { public BadPacketsX(GrimPlayer player) { @@ -45,26 +50,44 @@ public void onBlockBreak(BlockBreak blockBreak) { && lastBlockType.getBlastResistance() == 0.0F && block == StateTypes.WATER ) return; - lastTick = newTick; - lastBreakLoc = blockBreak.position; - lastBlockType = block; - // the block does not have a hitbox - boolean invalid = (block == StateTypes.LIGHT && !(player.getInventory().getHeldItem().is(ItemTypes.LIGHT) || player.getInventory().getOffHand().is(ItemTypes.LIGHT))) - || block.isAir() - || block == StateTypes.WATER - || block == StateTypes.LAVA - || block == StateTypes.BUBBLE_COLUMN - || block == StateTypes.MOVING_PISTON - || block == StateTypes.FIRE && noFireHitbox - // or the client claims to have broken an unbreakable block - || block.getHardness() == -1.0f && blockBreak.action == DiggingAction.FINISHED_DIGGING; + // prevents rare false on rapidly breaking short grass + List previousBlockStates = player.blockHistory.modificationQueue.stream() + .filter((blockModification) -> blockModification.getLocation().equals(blockBreak.position) + && newTick - blockModification.getTick() < 2 + && (blockModification.getCause() == BlockModification.Cause.START_DIGGING || blockModification.getCause() == BlockModification.Cause.HANDLE_NETTY_SYNC_TRANSACTION)) + .flatMap(mod -> Stream.of(mod.getOldBlockContents().getType())) + .collect(Collectors.toList()); + + previousBlockStates.add(0, block); - if (invalid && flagAndAlert("block=" + block.getName() + ", type=" + blockBreak.action) && shouldModifyPackets()) { + boolean invalid = false; + for (StateType possibleBlockState : previousBlockStates) { + // the block does not have a hitbox + invalid = (possibleBlockState == StateTypes.LIGHT && !(player.getInventory().getHeldItem().is(ItemTypes.LIGHT) || player.getInventory().getOffHand().is(ItemTypes.LIGHT))) + || possibleBlockState.isAir() + || possibleBlockState == StateTypes.WATER + || possibleBlockState == StateTypes.LAVA + || possibleBlockState == StateTypes.BUBBLE_COLUMN + || possibleBlockState == StateTypes.MOVING_PISTON + || possibleBlockState == StateTypes.FIRE && noFireHitbox + // or the client claims to have broken an unbreakable block + || possibleBlockState.getHardness() == -1.0f && blockBreak.action == DiggingAction.FINISHED_DIGGING; + if (!invalid) { + break; + } + } + + if (invalid && flagAndAlert("block=" + block.getName() + ", type=" + blockBreak.action)) { didLastFlag = true; - blockBreak.cancel(); + if (shouldModifyPackets()) { + blockBreak.cancel(); + } } else { didLastFlag = false; } + lastTick = newTick; + lastBreakLoc = blockBreak.position; + lastBlockType = block; } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java b/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java index f1513580d7..c39efe9848 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java @@ -173,11 +173,11 @@ private void tickBetterReachCheckWithAngle(boolean isFlying) { if (reachEntity != null) { Pair, String> result = checkReach(reachEntity, attack.getValue(), false); if (result != null) { - PacketCheck check = player.checkManager.getPacketCheck(result.getFirst()); + PacketCheck check = player.checkManager.getPacketCheck(result.first()); if (reachEntity.getType() == EntityTypes.PLAYER) { - ((Check)check).flagAndAlert(result.getSecond()); + ((Check)check).flagAndAlert(result.second()); } else { - ((Check) check).flagAndAlert(result.getSecond() + "type=" + reachEntity.getType().getName().getKey()); + ((Check) check).flagAndAlert(result.second() + "type=" + reachEntity.getType().getName().getKey()); } } } @@ -242,7 +242,7 @@ private Pair, String> checkReach(PacketEntity reach Vector eyePos = new Vector(from.getX(), from.getY() + eye, from.getZ()); Vector endReachPos = eyePos.clone().add(new Vector(lookVec.getX() * distance, lookVec.getY() * distance, lookVec.getZ() * distance)); - Vector intercept = ReachUtils.calculateIntercept(targetBox, eyePos, endReachPos).getFirst(); + Vector intercept = ReachUtils.calculateIntercept(targetBox, eyePos, endReachPos).first(); if (ReachUtils.isVecInside(targetBox, eyePos)) { minDistance = 0; @@ -270,9 +270,9 @@ private Pair, String> checkReach(PacketEntity reach // - This filters out when the ray trace hits the target entity without having to do an expensive .equals() // - You may have to adjust the epsilon if you increase the reach threshold, especially by a lot // ...but there is literally no reason you would ever want to increase it, only decrease, so that doesn't matter. - if (hitResult != null && (minDistance * minDistance) - hitResult.getFirst() > ENTITY_HITBOX_REACH_EPSILON) { // returned double is distanceSq + if (hitResult != null && (minDistance * minDistance) - hitResult.first() > ENTITY_HITBOX_REACH_EPSILON) { // returned double is distanceSq minDistance = Double.MIN_VALUE; - foundHitData = hitResult.getSecond(); + foundHitData = hitResult.second(); } } } 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 7849935432..a34120eb56 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow.WindowClickType; @@ -26,7 +25,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if ((clickType == WindowClickType.PICKUP || clickType == WindowClickType.PICKUP_ALL) && player.packetOrderProcessor.isQuickMoveClicking() || clickType == WindowClickType.QUICK_MOVE && player.packetOrderProcessor.isPickUpClicking()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert() && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -40,8 +39,7 @@ public void onPacketReceive(PacketReceiveEvent event) { @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java new file mode 100644 index 0000000000..e103e89c98 --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java @@ -0,0 +1,13 @@ +package ac.grim.grimac.checks.impl.packetorder; + +import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.player.GrimPlayer; + +@CheckData(name = "PacketOrderD") +public class PacketOrderD extends Check implements PacketCheck { + public PacketOrderD(GrimPlayer player) { + super(player); + } +} 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 3c6bf544d7..aaf111e4de 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; @CheckData(name = "PacketOrderE", experimental = true) public class PacketOrderE extends Check implements PostPredictionCheck { @@ -31,7 +30,7 @@ public void onPacketReceive(PacketReceiveEvent event) { || player.packetOrderProcessor.isStartingToGlide() || player.packetOrderProcessor.isJumpingWithMount() ) { - if (player.getClientVersion().isNewerThan(ClientVersion.V_1_8) || flagAndAlert()) { + if (player.canSkipTicks() || flagAndAlert()) { invalid++; if (player.packetOrderProcessor.isUsing()) { @@ -44,7 +43,7 @@ public void onPacketReceive(PacketReceiveEvent event) { @Override public void onPredictionComplete(PredictionComplete predictionComplete) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (setback) { setback = false; setbackIfAboveSetbackVL(); 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 dd6a157f7d..d5236b3389 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.DiggingAction; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClientStatus; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; @@ -30,7 +29,7 @@ public void onPacketReceive(PacketReceiveEvent event) { || (event.getPacketType() == PacketType.Play.Client.CLIENT_STATUS && new WrapperPlayClientClientStatus(event).getAction() == WrapperPlayClientClientStatus.Action.OPEN_INVENTORY_ACHIEVEMENT) ) if (player.packetOrderProcessor.isSprinting() || player.packetOrderProcessor.isSneaking()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert() && shouldModifyPackets()) { if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING && new WrapperPlayClientPlayerDigging(event).getAction() == DiggingAction.RELEASE_USE_ITEM @@ -47,8 +46,7 @@ && new WrapperPlayClientPlayerDigging(event).getAction() == DiggingAction.RELEAS @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { 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 f6ecdb06ec..ac675e186e 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.DiggingAction; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClientStatus; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; @@ -41,7 +40,7 @@ && new WrapperPlayClientClientStatus(event).getAction() == WrapperPlayClientClie || player.packetOrderProcessor.isPicking() || player.packetOrderProcessor.isDigging() ) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert() && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -55,8 +54,7 @@ && new WrapperPlayClientClientStatus(event).getAction() == WrapperPlayClientClie @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { 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 fda60958d6..92156adc0a 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 @@ -24,21 +24,32 @@ public void onPacketReceive(PacketReceiveEvent event) { switch (new WrapperPlayClientEntityAction(event).getAction()) { case START_SPRINTING: case STOP_SPRINTING: - if (player.packetOrderProcessor.isSneaking()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (player.getClientVersion().isOlderThan(ClientVersion.V_1_21_2) && player.packetOrderProcessor.isSneaking()) { + if (!player.canSkipTicks()) { flagAndAlert(); } else { invalid++; } } + break; + + case START_SNEAKING: + case STOP_SNEAKING: + if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2) && player.packetOrderProcessor.isSprinting()) { + if (!player.canSkipTicks()) { + flagAndAlert(); + } else { + invalid++; + } + } + break; } } } @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { 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 4798581d0b..b6b373fb2a 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 @@ -13,7 +13,6 @@ import com.github.retrooper.packetevents.protocol.player.GameMode; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; -import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; import java.util.ArrayDeque; @@ -34,7 +33,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) { if (new WrapperPlayClientInteractEntity(event).getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK) { if (player.packetOrderProcessor.isRightClicking() || player.packetOrderProcessor.isPicking() || player.packetOrderProcessor.isReleasing() || player.packetOrderProcessor.isDigging()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert("attack") && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -44,7 +43,7 @@ public void onPacketReceive(PacketReceiveEvent event) { } } } else if (player.packetOrderProcessor.isReleasing() || player.packetOrderProcessor.isDigging()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert("interact") && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -57,7 +56,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT || event.getPacketType() == PacketType.Play.Client.USE_ITEM) { if (player.packetOrderProcessor.isReleasing() || digging) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert("place/use") && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -74,7 +73,7 @@ public void onPacketReceive(PacketReceiveEvent event) { switch (packet.getAction()) { case RELEASE_USE_ITEM: if (player.packetOrderProcessor.isAttacking() || player.packetOrderProcessor.isRightClicking() || player.packetOrderProcessor.isPicking() || player.packetOrderProcessor.isDigging()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert("release")) { setback = true; } @@ -98,19 +97,22 @@ public void onPacketReceive(PacketReceiveEvent event) { } } - if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8) && !player.packetStateData.lastPacketWasTeleport) { + if (isTickPacket(event.getPacketType())) { digging = false; } } @Override public void onPredictionComplete(PredictionComplete predictionComplete) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (setback) { setbackIfAboveSetbackVL(); setback = false; } - } else if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { + return; + } + + if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (String verbose : flags) { if (flagAndAlert(verbose) && setback) { setbackIfAboveSetbackVL(); @@ -120,7 +122,7 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { } flags.clear(); - setback = digging = false; + setback = false; } @Override 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 bbe57054a1..bdded5deb7 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; @CheckData(name = "PacketOrderJ", experimental = true) public class PacketOrderJ extends Check implements PostPredictionCheck { @@ -21,7 +20,7 @@ public PacketOrderJ(final GrimPlayer player) { public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT || event.getPacketType() == PacketType.Play.Client.USE_ITEM) { if (player.packetOrderProcessor.isAttacking() && !player.packetOrderProcessor.isInteracting()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert() && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -35,8 +34,7 @@ public void onPacketReceive(PacketReceiveEvent event) { @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { 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 5462f9b158..82eef65b88 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClientStatus; import java.util.ArrayDeque; @@ -25,7 +24,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.CLIENT_STATUS) { if (new WrapperPlayClientClientStatus(event).getAction() == WrapperPlayClientClientStatus.Action.OPEN_INVENTORY_ACHIEVEMENT) { if (player.packetOrderProcessor.isClickingInInventory() || player.packetOrderProcessor.isClosingInventory()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { flagAndAlert("open"); } else { flags.add("open"); @@ -36,7 +35,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW || event.getPacketType() == PacketType.Play.Client.CLOSE_WINDOW) { if (player.packetOrderProcessor.isOpeningInventory()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert(event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW ? "click" : "close") && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -50,8 +49,7 @@ public void onPacketReceive(PacketReceiveEvent event) { @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (String verbose : flags) { 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 634bd5bc67..a00a2c62b0 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 @@ -7,7 +7,6 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.DiggingAction; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClientStatus; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; @@ -27,7 +26,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.CLIENT_STATUS) { if (new WrapperPlayClientClientStatus(event).getAction() == WrapperPlayClientClientStatus.Action.OPEN_INVENTORY_ACHIEVEMENT) { if (player.packetOrderProcessor.isDropping()) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert("inventory") && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -42,7 +41,14 @@ public void onPacketReceive(PacketReceiveEvent event) { if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) { if (new WrapperPlayClientPlayerDigging(event).getAction() == DiggingAction.SWAP_ITEM_WITH_OFFHAND) { if (player.packetOrderProcessor.isDropping()) { - flags.add("swap"); + if (!player.canSkipTicks()) { + if (flagAndAlert("swap") && shouldModifyPackets()) { + event.setCancelled(true); + player.onPacketCancel(); + } + } else { + flags.add("swap"); + } } } } @@ -50,8 +56,7 @@ public void onPacketReceive(PacketReceiveEvent event) { @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (String verbose : flags) { 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 462e24e712..c2cbd3158c 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 @@ -7,11 +7,9 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.protocol.world.BlockFace; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement; -import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "PacketOrderM", experimental = true) public class PacketOrderM extends Check implements PostPredictionCheck { @@ -28,7 +26,7 @@ public void onPacketReceive(PacketReceiveEvent event) { if (new WrapperPlayClientInteractEntity(event).getAction() != WrapperPlayClientInteractEntity.InteractAction.ATTACK) { interacting = true; if (usingWithoutInteract) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert() && shouldModifyPackets()) { event.setCancelled(true); player.onPacketCancel(); @@ -50,15 +48,14 @@ && new WrapperPlayClientPlayerBlockPlacement(event).getFace() == BlockFace.OTHER interacting = false; } - if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8) && !player.packetStateData.lastPacketWasTeleport) { + if (isTickPacket(event.getPacketType())) { usingWithoutInteract = interacting = false; } } @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { @@ -67,6 +64,5 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { } invalid = 0; - usingWithoutInteract = interacting = false; } } 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 c36e737ef3..3b0a5f3303 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 @@ -7,10 +7,8 @@ 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.player.ClientVersion; import com.github.retrooper.packetevents.protocol.world.BlockFace; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement; -import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "PacketOrderN", experimental = true) public class PacketOrderN extends BlockPlaceCheck { @@ -25,7 +23,7 @@ public PacketOrderN(final GrimPlayer player) { public void onBlockPlace(BlockPlace place) { placing = true; if (usingWithoutPlacing) { - if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) { + if (!player.canSkipTicks()) { if (flagAndAlert() && shouldModifyPackets() && shouldCancel()) { place.resync(); } @@ -47,15 +45,14 @@ && new WrapperPlayClientPlayerBlockPlacement(event).getFace() == BlockFace.OTHER placing = false; } - if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8) && !player.packetStateData.lastPacketWasTeleport) { + if (isTickPacket(event.getPacketType())) { usingWithoutPlacing = placing = false; } } @Override 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.canSkipTicks()) return; if (player.isTickingReliablyFor(3) && !player.uncertaintyHandler.lastVehicleSwitch.hasOccurredSince(0)) { for (; invalid >= 1; invalid--) { @@ -64,6 +61,5 @@ public void onPredictionComplete(PredictionComplete predictionComplete) { } invalid = 0; - usingWithoutPlacing = placing = false; } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java index aab11c669d..ff35be31d9 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java @@ -10,9 +10,8 @@ import com.github.retrooper.packetevents.protocol.player.InteractionHand; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction; -import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; -@CheckData(name = "PacketOrderP", experimental = true) +@CheckData(name = "PacketOrderO", experimental = true) public class PacketOrderO extends Check implements PacketCheck { public PacketOrderO(final GrimPlayer player) { super(player); @@ -56,7 +55,7 @@ public void onPacketReceive(PacketReceiveEvent event) { } } - if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && !player.packetStateData.lastPacketWasTeleport && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) { + if (isTickPacket(event.getPacketType())) { sentMainhand = false; } } 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 9845de1faa..0506b96455 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 @@ -1,7 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PostPredictionCheck; +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.protocol.packettype.PacketType; @@ -12,7 +12,7 @@ import org.jetbrains.annotations.Contract; @Getter -public final class PacketOrderProcessor extends Check implements PostPredictionCheck { +public final class PacketOrderProcessor extends Check implements PacketCheck { public PacketOrderProcessor(final GrimPlayer player) { super(player); } @@ -135,7 +135,7 @@ public void onPacketReceive(PacketReceiveEvent event) { closingInventory = true; } - if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && !player.packetStateData.lastPacketWasTeleport && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) { + if (isTickPacket(packetType)) { openingInventory = false; swapping = false; dropping = false; diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/TransactionOrder.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/TransactionOrder.java index 6fc8b8f819..8b13789179 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/TransactionOrder.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/TransactionOrder.java @@ -1,13 +1 @@ -package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; -import ac.grim.grimac.player.GrimPlayer; - -@CheckData(name = "TransactionOrder", experimental = false) -public class TransactionOrder extends Check implements PacketCheck { - public TransactionOrder(GrimPlayer player) { - super(player); - } -} diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 8852fff15b..08dcef49f3 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -17,6 +17,8 @@ import ac.grim.grimac.checks.impl.misc.GhostBlockMitigation; import ac.grim.grimac.checks.impl.movement.*; import ac.grim.grimac.checks.impl.packetorder.*; +import ac.grim.grimac.checks.impl.multiactions.*; +import ac.grim.grimac.checks.impl.packetorder.*; import ac.grim.grimac.checks.impl.post.Post; import ac.grim.grimac.checks.impl.multiactions.*; import ac.grim.grimac.checks.impl.prediction.DebugHandler; @@ -115,8 +117,7 @@ public CheckManager(GrimPlayer player) { .put(MultiActionsE.class, new MultiActionsE(player)) .put(PacketOrderB.class, new PacketOrderB(player)) .put(PacketOrderC.class, new PacketOrderC(player)) - .put(TransactionOrder.class, new TransactionOrder(player)) - .put(PacketOrderP.class, new PacketOrderP(player)) + .put(PacketOrderD.class, new PacketOrderD(player)) .put(PacketOrderO.class, new PacketOrderO(player)) .put(NoSlowB.class, new NoSlowB(player)) .put(SetbackBlocker.class, new SetbackBlocker(player)) // Must be last class otherwise we can't check while blocking packets diff --git a/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java b/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java index ce2e332e74..534a5ebcec 100644 --- a/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java +++ b/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java @@ -154,12 +154,12 @@ private void blockMovementsUntilResync(boolean simulateNextTickPosition, boolean VelocityData futureExplosion = player.checkManager.getExplosionHandler().getFutureExplosion(); // Velocity sets - if (futureKb.getFirst() != null) { - clientVel = futureKb.getSecond(); + if (futureKb.first() != null) { + clientVel = futureKb.second(); } // Explosion adds - if (futureExplosion != null && (futureKb.getFirst() == null || futureKb.getFirst().transaction < futureExplosion.transaction)) { + if (futureExplosion != null && (futureKb.first() == null || futureKb.first().transaction < futureExplosion.transaction)) { clientVel.add(futureExplosion.vector); } @@ -329,16 +329,16 @@ public boolean checkVehicleTeleportQueue(double x, double y, double z) { while (true) { Pair teleportPos = player.vehicleData.vehicleTeleports.peek(); if (teleportPos == null) break; - if (lastTransaction < teleportPos.getFirst()) { + if (lastTransaction < teleportPos.first()) { break; } - Vector3d position = teleportPos.getSecond(); + Vector3d position = teleportPos.second(); if (position.getX() == x && position.getY() == y && position.getZ() == z) { player.vehicleData.vehicleTeleports.poll(); return true; - } else if (lastTransaction > teleportPos.getFirst() + 1) { + } else if (lastTransaction > teleportPos.first() + 1) { player.vehicleData.vehicleTeleports.poll(); // Vehicles have terrible netcode so just ignore it if the teleport wasn't from us setting the player back diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index 531920c9dc..66ea19a9ea 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -7,8 +7,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.impl.aim.processor.AimProcessor; import ac.grim.grimac.checks.impl.misc.ClientBrand; -import ac.grim.grimac.checks.impl.packetorder.TransactionOrder; import ac.grim.grimac.checks.impl.packetorder.PacketOrderProcessor; +import ac.grim.grimac.checks.impl.packetorder.PacketOrderD; import ac.grim.grimac.events.packets.CheckManagerListener; import ac.grim.grimac.manager.*; import ac.grim.grimac.predictionengine.MovementCheckRunner; @@ -58,6 +58,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -335,7 +336,7 @@ public boolean addTransactionResponse(short id) { boolean hasID = false; int skipped = 0; for (Pair iterator : transactionsSent) { - if (iterator.getFirst() == id) { + if (iterator.first() == id) { hasID = true; break; } @@ -347,7 +348,7 @@ public boolean addTransactionResponse(short id) { if (packetTracker != null) packetTracker.setIntervalPackets(packetTracker.getIntervalPackets() - 1); if (skipped > 0 && System.currentTimeMillis() - joinTime > 5000) - checkManager.getPacketCheck(TransactionOrder.class).flagAndAlert("skipped: " + skipped); + checkManager.getPacketCheck(PacketOrderD.class).flagAndAlert("skipped: " + skipped); do { data = transactionsSent.poll(); @@ -356,9 +357,9 @@ public boolean addTransactionResponse(short id) { lastTransactionReceived.incrementAndGet(); lastTransReceived = System.currentTimeMillis(); - transactionPing = (System.nanoTime() - data.getSecond()); - playerClockAtLeast = data.getSecond(); - } while (data.getFirst() != id); + transactionPing = (System.nanoTime() - data.second()); + playerClockAtLeast = data.second(); + } while (data.first() != id); // A transaction means a new tick, so apply any block places CheckManagerListener.handleQueuedPlaces(this, false, 0, 0, System.currentTimeMillis()); @@ -366,7 +367,7 @@ public boolean addTransactionResponse(short id) { } // Were we the ones who sent the packet? - return data != null && data.getFirst() == id; + return data != null && data.first() == id; } public void baseTickAddWaterPushing(Vector vector) { @@ -577,8 +578,7 @@ public ClientVersion getClientVersion() { public boolean isTickingReliablyFor(int ticks) { // 1.21.2+: Tick end packet, on servers 1.21.2+ // 1.8-: Flying packet - return supportsEndTick() - || getClientVersion().isOlderThan(ClientVersion.V_1_9) + return !canSkipTicks() || !uncertaintyHandler.lastPointThree.hasOccurredSince(ticks) || compensatedEntities.getSelf().inVehicle(); } @@ -719,6 +719,11 @@ public boolean supportsEndTick() { return getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_2); } + @Contract(pure = true) + public boolean canSkipTicks() { + return getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) && !supportsEndTick(); + } + @Override public void runSafely(Runnable runnable) { ChannelHelper.runInEventLoop(this.user.getChannel(), runnable); diff --git a/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java b/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java index c36a1c922c..e38fffc470 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java +++ b/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java @@ -339,7 +339,7 @@ private void check(PositionUpdate update) { boolean clientClaimsRiptide = player.packetStateData.tryingToRiptide; if (player.packetStateData.tryingToRiptide) { long currentTime = System.currentTimeMillis(); - boolean isInWater = player.compensatedWorld.isRaining || Collisions.hasMaterial(player, player.boundingBox.copy().expand(0.1f), (block) -> Materials.isWater(CompensatedWorld.blockVersion, block.getFirst())); + boolean isInWater = player.compensatedWorld.isRaining || Collisions.hasMaterial(player, player.boundingBox.copy().expand(0.1f), (block) -> Materials.isWater(CompensatedWorld.blockVersion, block.first())); if (currentTime - player.packetStateData.lastRiptide < 450 || !isInWater) { player.packetStateData.tryingToRiptide = false; @@ -350,7 +350,7 @@ private void check(PositionUpdate update) { SimpleCollisionBox steppingOnBB = GetBoundingBox.getCollisionBoxForPlayer(player, player.x, player.y, player.z).expand(player.getMovementThreshold()).offset(0, -1, 0); Collisions.hasMaterial(player, steppingOnBB, (pair) -> { - WrappedBlockState data = pair.getFirst(); + WrappedBlockState data = pair.first(); if (data.getType() == StateTypes.SLIME_BLOCK && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) { player.uncertaintyHandler.isSteppingOnSlime = true; player.uncertaintyHandler.isSteppingOnBouncyBlock = true; @@ -396,8 +396,8 @@ private void check(PositionUpdate update) { player.uncertaintyHandler.isNearGlitchyBlock = player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && Collisions.hasMaterial(player, expandedBB.copy().expand(0.2), - checkData -> BlockTags.ANVIL.contains(checkData.getFirst().getType()) - || checkData.getFirst().getType() == StateTypes.CHEST || checkData.getFirst().getType() == StateTypes.TRAPPED_CHEST); + checkData -> BlockTags.ANVIL.contains(checkData.first().getType()) + || checkData.first().getType() == StateTypes.CHEST || checkData.first().getType() == StateTypes.TRAPPED_CHEST); player.uncertaintyHandler.isOrWasNearGlitchyBlock = isGlitchy || player.uncertaintyHandler.isNearGlitchyBlock; player.uncertaintyHandler.checkForHardCollision(); diff --git a/src/main/java/ac/grim/grimac/predictionengine/PointThreeEstimator.java b/src/main/java/ac/grim/grimac/predictionengine/PointThreeEstimator.java index 39acdeb033..762ee92e1d 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/PointThreeEstimator.java +++ b/src/main/java/ac/grim/grimac/predictionengine/PointThreeEstimator.java @@ -257,21 +257,21 @@ private void checkNearbyBlocks(SimpleCollisionBox pointThreeBox) { // Check for flowing water Collisions.hasMaterial(player, pointThreeBox, (pair) -> { - final WrappedBlockState state = pair.getFirst(); + final WrappedBlockState state = pair.first(); final StateType stateType = state.getType(); if (player.tagManager.block(SyncedTags.CLIMBABLE).contains(stateType) || (stateType == StateTypes.POWDER_SNOW && !player.compensatedEntities.getSelf().inVehicle() && player.getInventory().getBoots().getType() == ItemTypes.LEATHER_BOOTS)) { isNearClimbable = true; } if (BlockTags.TRAPDOORS.contains(stateType)) { - isNearClimbable = isNearClimbable || Collisions.trapdoorUsableAsLadder(player, pair.getSecond().getX(), pair.getSecond().getY(), pair.getSecond().getZ(), state); + isNearClimbable = isNearClimbable || Collisions.trapdoorUsableAsLadder(player, pair.second().getX(), pair.second().getY(), pair.second().getZ(), state); } if (stateType == StateTypes.BUBBLE_COLUMN) { isNearBubbleColumn = true; } - if (Materials.isWater(player.getClientVersion(), pair.getFirst()) || pair.getFirst().getType() == StateTypes.LAVA) { + if (Materials.isWater(player.getClientVersion(), pair.first()) || pair.first().getType() == StateTypes.LAVA) { isNearFluid = true; } diff --git a/src/main/java/ac/grim/grimac/predictionengine/predictions/PredictionEngine.java b/src/main/java/ac/grim/grimac/predictionengine/predictions/PredictionEngine.java index c9e376b3a8..03d52f534b 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/predictions/PredictionEngine.java +++ b/src/main/java/ac/grim/grimac/predictionengine/predictions/PredictionEngine.java @@ -136,8 +136,8 @@ private void doPredictions(GrimPlayer player, List possibleVelocitie // Returns pair of primary push movement, and then outputvel Pair output = doSeekingWallCollisions(player, primaryPushMovement, originalClientVel, clientVelAfterInput); - primaryPushMovement = output.getFirst(); - Vector outputVel = clampMovementToHardBorder(player, output.getSecond()); + primaryPushMovement = output.first(); + Vector outputVel = clampMovementToHardBorder(player, output.second()); double resultAccuracy = outputVel.distanceSquared(player.actualMovement); diff --git a/src/main/java/ac/grim/grimac/utils/anticheat/update/BlockPlace.java b/src/main/java/ac/grim/grimac/utils/anticheat/update/BlockPlace.java index e2799009a5..f5306b20f0 100644 --- a/src/main/java/ac/grim/grimac/utils/anticheat/update/BlockPlace.java +++ b/src/main/java/ac/grim/grimac/utils/anticheat/update/BlockPlace.java @@ -675,7 +675,7 @@ public Vector getClickedLocation() { final double distance = player.compensatedEntities.getSelf().getAttributeValue(Attributes.BLOCK_INTERACTION_RANGE) + 3; Vector eyePos = new Vector(player.x, player.y + player.getEyeHeight(), player.z); Vector endReachPos = eyePos.clone().add(new Vector(look.getX() * distance, look.getY() * distance, look.getZ() * distance)); - Vector intercept = ReachUtils.calculateIntercept(box, eyePos, endReachPos).getFirst(); + Vector intercept = ReachUtils.calculateIntercept(box, eyePos, endReachPos).first(); // Bring this back to relative to the block // The player didn't even click the block... (we should force resync BEFORE we get here!) diff --git a/src/main/java/ac/grim/grimac/utils/change/PlayerBlockHistory.java b/src/main/java/ac/grim/grimac/utils/change/PlayerBlockHistory.java index a5a07e5da6..0cd9b1f756 100644 --- a/src/main/java/ac/grim/grimac/utils/change/PlayerBlockHistory.java +++ b/src/main/java/ac/grim/grimac/utils/change/PlayerBlockHistory.java @@ -1,37 +1,62 @@ package ac.grim.grimac.utils.change; +import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState; + import java.util.ArrayDeque; import java.util.Deque; +import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; +import java.util.stream.Stream; public class PlayerBlockHistory { - private final Deque blockHistory = new ArrayDeque<>(); + public final Deque modificationQueue = new ArrayDeque<>(); // Add a new block modification to the history. public void add(BlockModification modification) { - blockHistory.add(modification); + modificationQueue.add(modification); } // Get all recent modifications (optionally filtered by a condition). - public Iterable getRecentModifications(Predicate filter) { - return blockHistory.stream().filter(filter).collect(Collectors.toList()); // Java 8+ compatible + public List getRecentModifications(Predicate filter) { + return modificationQueue.stream().filter(filter).collect(Collectors.toList()); // Java 8+ compatible + } + + public List getBlockStates(Predicate filter) { + return modificationQueue.stream() + .filter(filter) + .flatMap(mod -> Stream.of(mod.getOldBlockContents(), mod.getNewBlockContents())) + .collect(Collectors.toList());// Java 8+ compatible + } + + public List getPreviousBlockStates(Predicate filter) { + return modificationQueue.stream() + .filter(filter) + .map(BlockModification::getOldBlockContents) + .collect(Collectors.toList()); + } + + public List getResultingBlockStates(Predicate filter) { + return modificationQueue.stream() + .filter(filter) + .map(BlockModification::getNewBlockContents) + .collect(Collectors.toList()); } // Remove old modifications older than maxTick public void cleanup(int maxTick) { - while (!blockHistory.isEmpty() && maxTick - blockHistory.peekFirst().getTick() > 0) { - blockHistory.removeFirst(); + while (!modificationQueue.isEmpty() && maxTick - modificationQueue.peekFirst().getTick() > 0) { + modificationQueue.removeFirst(); } } // Get the size of the block history public int size() { - return blockHistory.size(); + return modificationQueue.size(); } // Clear all block modifications public void clear() { - blockHistory.clear(); + modificationQueue.clear(); } } diff --git a/src/main/java/ac/grim/grimac/utils/data/Pair.java b/src/main/java/ac/grim/grimac/utils/data/Pair.java index 06c0f4928b..3df470f629 100644 --- a/src/main/java/ac/grim/grimac/utils/data/Pair.java +++ b/src/main/java/ac/grim/grimac/utils/data/Pair.java @@ -33,11 +33,11 @@ public static Pair of(T a, K b) { return new Pair(a, b); } - public A getFirst() { + public A first() { return first; } - public B getSecond() { + public B second() { return second; } diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java index 4e4ba2b122..a98521a7bc 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java @@ -619,7 +619,7 @@ public boolean isWaterSourceBlock(int x, int y, int z) { } public boolean containsLiquid(SimpleCollisionBox var0) { - return Collisions.hasMaterial(player, var0, data -> Materials.isWater(player.getClientVersion(), data.getFirst()) || data.getFirst().getType() == StateTypes.LAVA); + return Collisions.hasMaterial(player, var0, data -> Materials.isWater(player.getClientVersion(), data.first()) || data.first().getType() == StateTypes.LAVA); } public double getLavaFluidLevelAt(int x, int y, int z) { @@ -641,7 +641,7 @@ public double getLavaFluidLevelAt(int x, int y, int z) { } public boolean containsLava(SimpleCollisionBox var0) { - return Collisions.hasMaterial(player, var0, data -> data.getFirst().getType() == StateTypes.LAVA); + return Collisions.hasMaterial(player, var0, data -> data.first().getType() == StateTypes.LAVA); } public double getWaterFluidLevelAt(double x, double y, double z) { diff --git a/src/main/java/ac/grim/grimac/utils/latency/LatencyUtils.java b/src/main/java/ac/grim/grimac/utils/latency/LatencyUtils.java index 05bdad1f68..8b56882e2b 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/LatencyUtils.java +++ b/src/main/java/ac/grim/grimac/utils/latency/LatencyUtils.java @@ -43,17 +43,17 @@ public void handleNettySyncTransaction(int transaction) { Pair pair = iterator.next(); // We are at most a tick ahead when running tasks based on transactions, meaning this is too far - if (transaction + 1 < pair.getFirst()) + if (transaction + 1 < pair.first()) return; // This is at most tick ahead of what we want - if (transaction == pair.getFirst() - 1) + if (transaction == pair.first() - 1) continue; try { // Run the task - pair.getSecond().run(); + pair.second().run(); } catch (Exception e) { System.out.println("An error has occurred when running transactions for player: " + player.user.getName()); e.printStackTrace(); diff --git a/src/main/java/ac/grim/grimac/utils/nmsutil/BlockRayTrace.java b/src/main/java/ac/grim/grimac/utils/nmsutil/BlockRayTrace.java index 81f2f6b96e..4fbe6de374 100644 --- a/src/main/java/ac/grim/grimac/utils/nmsutil/BlockRayTrace.java +++ b/src/main/java/ac/grim/grimac/utils/nmsutil/BlockRayTrace.java @@ -1,7 +1,9 @@ package ac.grim.grimac.utils.nmsutil; +import ac.grim.grimac.GrimAPI; import ac.grim.grimac.checks.impl.combat.Reach; import ac.grim.grimac.player.GrimPlayer; +import ac.grim.grimac.utils.change.BlockModification; import ac.grim.grimac.utils.collisions.HitboxData; import ac.grim.grimac.utils.collisions.RaycastData; import ac.grim.grimac.utils.collisions.datatypes.CollisionBox; @@ -27,6 +29,7 @@ import org.jetbrains.annotations.Nullable; import java.util.Arrays; +import java.util.List; import java.util.function.BiFunction; import java.util.stream.Collectors; @@ -188,79 +191,107 @@ public static BlockHitData getNearestHitResult(GrimPlayer player, double[] start }; return (BlockHitData) traverseBlocks(player, startPos, endPos, (block, vector3i) -> { - CollisionBox data; - if (!raycastContext) { - data = HitboxData.getBlockHitbox(player, player.getInventory().getHeldItem().getType().getPlacedType(), player.getClientVersion(), block, vector3i.x, vector3i.y, vector3i.z); - } else { - data = RaycastData.getBlockHitbox(player, null, player.getClientVersion(), block, vector3i.x, vector3i.y, vector3i.z); - } - if (data == NoCollisionBox.INSTANCE) return null; - int size = data.downCast(boxes); + int currentTick = GrimAPI.INSTANCE.getTickManager().currentTick; - double bestHitResult = Double.MAX_VALUE; - double[] bestHitLoc = null; - BlockFace bestFace = null; + List blockModifications = + player.blockHistory.getBlockStates((blockModification -> blockModification.getLocation().equals(vector3i) + && currentTick - blockModification.getTick() < 2 + && (blockModification.getCause() == BlockModification.Cause.START_DIGGING || blockModification.getCause() == BlockModification.Cause.HANDLE_NETTY_SYNC_TRANSACTION))); + blockModifications.add(0, block); + BlockHitData hitData = null; boolean isTargetBlock = Arrays.equals(new int[]{vector3i.x, vector3i.y, vector3i.z}, targetBlockVec); - if (isTargetBlock) { - // BEWARE OF https://bugs.mojang.com/browse/MC-85109 FOR 1.8 PLAYERS - // 1.8 Brewing Stand hitbox is a fullblock until it is hit sometimes, can be caused be restarting client and joining server - if (block.getType() == StateTypes.BREWING_STAND && player.getClientVersion().equals(ClientVersion.V_1_8)) { - size++; - boxes[size] = new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true); + for (WrappedBlockState wrappedBlockState : blockModifications) { + hitData = didHitBlock(player, startPos, lookVec, currentDistance, maxDistance, targetBlockVec, expectedBlockFace, boxes, raycastContext, wrappedBlockState, vector3i); + if (isTargetBlock) { + // target block, check if any possible block allows the ray to hit + if (hitData != null && hitData.success) { + return hitData; + } + } else { + // non target block, we are checking if any possible block will allow the ray to pass through + if (hitData == null) { + return hitData; + } } } + return hitData; + }); + } + + public static BlockHitData didHitBlock(GrimPlayer player, double[] startPos, double[] lookVec, double currentDistance, double maxDistance, int[] targetBlockVec, BlockFace expectedBlockFace, SimpleCollisionBox[] boxes, boolean raycastContext, WrappedBlockState block, Vector3i vector3i) { + CollisionBox data; + if (!raycastContext) { + data = HitboxData.getBlockHitbox(player, player.getInventory().getHeldItem().getType().getPlacedType(), player.getClientVersion(), block, vector3i.x, vector3i.y, vector3i.z); + } else { + data = RaycastData.getBlockHitbox(player, null, player.getClientVersion(), block, vector3i.x, vector3i.y, vector3i.z); + } + if (data == NoCollisionBox.INSTANCE) return null; + int size = data.downCast(boxes); + + double bestHitResult = Double.MAX_VALUE; + double[] bestHitLoc = null; + BlockFace bestFace = null; + + boolean isTargetBlock = Arrays.equals(new int[]{vector3i.x, vector3i.y, vector3i.z}, targetBlockVec); + if (isTargetBlock) { + // BEWARE OF https://bugs.mojang.com/browse/MC-85109 FOR 1.8 PLAYERS + // 1.8 Brewing Stand hitbox is a fullblock until it is hit sometimes, can be caused be restarting client and joining server + if (block.getType() == StateTypes.BREWING_STAND && player.getClientVersion().equals(ClientVersion.V_1_8)) { + size++; + boxes[size] = new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true); + } + } - double[] currentEnd = new double[]{ - startPos[0] + lookVec[0] * currentDistance, - startPos[1] + lookVec[1] * currentDistance, - startPos[2] + lookVec[2] * currentDistance - }; + double[] currentEnd = new double[]{ + startPos[0] + lookVec[0] * currentDistance, + startPos[1] + lookVec[1] * currentDistance, + startPos[2] + lookVec[2] * currentDistance + }; - for (int i = 0; i < size; i++) { - Pair intercept = ReachUtilsPrimitives.calculateIntercept(boxes[i], startPos, currentEnd); - if (intercept.getFirst() == null) continue; // No intercept or wrong blockFace + for (int i = 0; i < size; i++) { + Pair intercept = ReachUtilsPrimitives.calculateIntercept(boxes[i], startPos, currentEnd); + if (intercept.first() == null) continue; // No intercept or wrong blockFace - double[] hitLoc = intercept.getFirst(); + double[] hitLoc = intercept.first(); - double distSq = distanceSquared(hitLoc, startPos); - if (distSq < bestHitResult) { - bestHitResult = distSq; - bestHitLoc = hitLoc; - bestFace = intercept.getSecond(); - if (isTargetBlock && bestFace == expectedBlockFace) { - return new BlockHitData(vector3i, new Vector(bestHitLoc[0], bestHitLoc[1], bestHitLoc[2]), bestFace, block, true); - } + double distSq = distanceSquared(hitLoc, startPos); + if (distSq < bestHitResult) { + bestHitResult = distSq; + bestHitLoc = hitLoc; + bestFace = intercept.second(); + if (isTargetBlock && bestFace == expectedBlockFace) { + return new BlockHitData(vector3i, new Vector(bestHitLoc[0], bestHitLoc[1], bestHitLoc[2]), bestFace, block, true); } } + } - // Yes, this is not the most optimal algorithm for handling Cauldrons, Hoppers, Composters, and Scaffolding - // that is to say, blocks that have a different outline/hitbox shape from the box used to calculate placement blockfaces - // but it is the one vanilla uses - // No we will not - // 1. Calculate the ray trace from a new closer startPos to reduce iterations - // because it adds a lot of code complexity for very little performance gain - // 2. Run a switch case on the target block and check if the index of the SimpleCollisionBox corresponds to a wall with an inside face - // and hardcode in blockface fixes for placements against those compnents above a certain relative y level - // because that is version-specific, will break if the implementation of the returned ComplexCollisionBox changes - // and again, lots of code complexity for little performance gain - if (bestHitLoc != null) { - BlockHitData hitData = new BlockHitData(vector3i, new Vector(bestHitLoc[0], bestHitLoc[1], bestHitLoc[2]), bestFace, block, isTargetBlock); - if (!raycastContext) { - BlockHitData hitData2 = BlockRayTrace.getNearestHitResult(player, startPos, lookVec, maxDistance, maxDistance, targetBlockVec, expectedBlockFace, boxes, true); - if (hitData2 != null) { - Vector startVector = new Vector(startPos[0], startPos[1], startPos[2]); - if (hitData2.getBlockHitLocation().subtract(startVector).lengthSquared() < - hitData.getBlockHitLocation().subtract(startVector).lengthSquared()) { - return new BlockHitData(vector3i, hitData.getBlockHitLocation(), hitData2.getClosestDirection(), block, isTargetBlock); - } + // Yes, this is not the most optimal algorithm for handling Cauldrons, Hoppers, Composters, and Scaffolding + // that is to say, blocks that have a different outline/hitbox shape from the box used to calculate placement blockfaces + // but it is the one vanilla uses + // No we will not + // 1. Calculate the ray trace from a new closer startPos to reduce iterations + // because it adds a lot of code complexity for very little performance gain + // 2. Run a switch case on the target block and check if the index of the SimpleCollisionBox corresponds to a wall with an inside face + // and hardcode in blockface fixes for placements against those compnents above a certain relative y level + // because that is version-specific, will break if the implementation of the returned ComplexCollisionBox changes + // and again, lots of code complexity for little performance gain + if (bestHitLoc != null) { + BlockHitData hitData = new BlockHitData(vector3i, new Vector(bestHitLoc[0], bestHitLoc[1], bestHitLoc[2]), bestFace, block, isTargetBlock); + if (!raycastContext) { + BlockHitData hitData2 = BlockRayTrace.didHitBlock(player, startPos, lookVec, maxDistance, maxDistance, targetBlockVec, expectedBlockFace, boxes, true, block, vector3i); + if (hitData2 != null) { + Vector startVector = new Vector(startPos[0], startPos[1], startPos[2]); + if (hitData2.getBlockHitLocation().subtract(startVector).lengthSquared() < + hitData.getBlockHitLocation().subtract(startVector).lengthSquared()) { + return new BlockHitData(vector3i, hitData.getBlockHitLocation(), hitData2.getClosestDirection(), block, isTargetBlock); } } - return hitData; } + return hitData; + } - return null; - }); + return null; } private static double distanceSquared(double[] vec1, double[] vec2) { @@ -342,11 +373,11 @@ public static HitData getNearestHitResult(GrimPlayer player, PacketEntity target Pair intercept = ReachUtils.calculateIntercept(box, trace.getOrigin(), trace.getPointAtDistance(Math.sqrt(closestDistanceSquared))); - if (intercept.getFirst() != null) { - double distSquared = intercept.getFirst().distanceSquared(startingVec); + if (intercept.first() != null) { + double distSquared = intercept.first().distanceSquared(startingVec); if (distSquared < closestDistanceSquared) { closestDistanceSquared = distSquared; - closestHitVec = intercept.getFirst(); + closestHitVec = intercept.first(); closestEntity = entity; } } @@ -373,9 +404,9 @@ private static HitData getTraverseResult(GrimPlayer player, @Nullable StateType for (int i = 0; i < size; i++) { if (shrinkBlocks) boxes[i].expand(-player.getMovementThreshold()); Pair intercept = ReachUtils.calculateIntercept(boxes[i], trace.getOrigin(), trace.getPointAtDistance(knownDistance)); - if (intercept.getFirst() == null) continue; // No intercept + if (intercept.first() == null) continue; // No intercept - Vector hitLoc = intercept.getFirst(); + Vector hitLoc = intercept.first(); // If inside a block, return empty result for reach check (don't bother checking this?) if (checkInside && ReachUtils.isVecInside(boxes[i], trace.getOrigin())) { @@ -385,7 +416,7 @@ private static HitData getTraverseResult(GrimPlayer player, @Nullable StateType if (hitLoc.distanceSquared(startingVec) < bestHitResult) { bestHitResult = hitLoc.distanceSquared(startingVec); bestHitLoc = hitLoc; - bestFace = intercept.getSecond(); + bestFace = intercept.second(); } } @@ -401,8 +432,8 @@ private static HitData getTraverseResult(GrimPlayer player, @Nullable StateType Pair intercept = ReachUtils.calculateIntercept(box, trace.getOrigin(), trace.getPointAtDistance(knownDistance)); - if (intercept.getFirst() != null) { - return new BlockHitData(vector3i, intercept.getFirst(), intercept.getSecond(), block, null); + if (intercept.first() != null) { + return new BlockHitData(vector3i, intercept.first(), intercept.second(), block, null); } } diff --git a/src/main/resources/punishments/de.yml b/src/main/resources/punishments/de.yml index 008bf73ff7..7dd3e0187a 100644 --- a/src/main/resources/punishments/de.yml +++ b/src/main/resources/punishments/de.yml @@ -42,6 +42,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +116,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/en.yml b/src/main/resources/punishments/en.yml index 593796b7a5..930b19c9ac 100644 --- a/src/main/resources/punishments/en.yml +++ b/src/main/resources/punishments/en.yml @@ -42,6 +42,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +116,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/es.yml b/src/main/resources/punishments/es.yml index de56bc401d..450f6314e8 100644 --- a/src/main/resources/punishments/es.yml +++ b/src/main/resources/punishments/es.yml @@ -42,6 +42,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +116,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/fr.yml b/src/main/resources/punishments/fr.yml index 52dae16f2b..131cd7aad0 100644 --- a/src/main/resources/punishments/fr.yml +++ b/src/main/resources/punishments/fr.yml @@ -42,6 +42,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +116,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" @@ -122,7 +130,7 @@ Punishments: commands: - "20:40 [alert]" - "20:40 [log]" - # A partir de la version 2.2.10, il n'y a plus de vérifications pour AutoClicker et c'est un placeholder. Grim inclura des vérifications AutoClicker dans le futur. + # A partir de la version 2.2.10, il n'y a plus de vérifications pour AutoClicker et c'est un placeholder. Grim inclura des vérifications AutoClicker dans le futur. Autoclicker: remove-violations-after: 300 checks: diff --git a/src/main/resources/punishments/it.yml b/src/main/resources/punishments/it.yml index 57db2a0d0a..81faae1df9 100644 --- a/src/main/resources/punishments/it.yml +++ b/src/main/resources/punishments/it.yml @@ -29,6 +29,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -94,7 +103,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/ja.yml b/src/main/resources/punishments/ja.yml index 017a4d71f2..3ad9f8d237 100644 --- a/src/main/resources/punishments/ja.yml +++ b/src/main/resources/punishments/ja.yml @@ -105,7 +105,6 @@ - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/nl.yml b/src/main/resources/punishments/nl.yml index e513c09d5d..d803274a0d 100644 --- a/src/main/resources/punishments/nl.yml +++ b/src/main/resources/punishments/nl.yml @@ -42,6 +42,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +116,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/pt.yml b/src/main/resources/punishments/pt.yml index d7d6689a77..e6c6b008ec 100644 --- a/src/main/resources/punishments/pt.yml +++ b/src/main/resources/punishments/pt.yml @@ -41,7 +41,15 @@ Punishments: - "5:5 [alert]" - "20:20 [webhook]" - "20:20 [proxy]" - - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +115,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/ru.yml b/src/main/resources/punishments/ru.yml index e106845251..f89f9bdc6a 100644 --- a/src/main/resources/punishments/ru.yml +++ b/src/main/resources/punishments/ru.yml @@ -42,6 +42,15 @@ Punishments: - "20:20 [webhook]" - "20:20 [proxy]" - "20:20 [log]" + Post: + remove-violations-after: 300 + checks: + - "Post" + commands: + - "20:20 [alert]" + - "40:40 [webhook]" + - "40:40 [proxy]" + - "40:40 [log]" BadPackets: remove-violations-after: 300 checks: @@ -107,7 +116,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/tr.yml b/src/main/resources/punishments/tr.yml index e628158550..a8229b6797 100644 --- a/src/main/resources/punishments/tr.yml +++ b/src/main/resources/punishments/tr.yml @@ -112,7 +112,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]" diff --git a/src/main/resources/punishments/zh.yml b/src/main/resources/punishments/zh.yml index 92486ffa47..38a72f45d8 100644 --- a/src/main/resources/punishments/zh.yml +++ b/src/main/resources/punishments/zh.yml @@ -107,7 +107,6 @@ Punishments: - "Place" - "Baritone" - "FastBreak" - - "TransactionOrder" commands: - "10:5 [alert]" - "20:10 [webhook]"