diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 5179576e..2d904b3d 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -474,11 +474,19 @@ public class MovingListener extends CheckListener implements TickListener, IRemo return; } - final long time = System.currentTimeMillis(); // TODO: pass to checks to use one reference time (set in data)? - if (player.isSprinting() && player.getFoodLevel() > 5){ - data.timeSprinting = time; + final long time = System.currentTimeMillis(); + if (player.isSprinting()){ + // + if (player.getFoodLevel() > 5){ + data.timeSprinting = time; + } + else if (time < data.timeSprinting){ + data.timeSprinting = 0; + } + // else: keep sprinting time. } - else if (time < data.timeSprinting){ + else{ + // Reset if not actually sprinting. data.timeSprinting = 0; } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index e721c0a2..9e21bc1a 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -171,6 +171,7 @@ public class SurvivalFly extends Check { // Prevent players from sprinting if they're moving backwards. if (sprinting) { + // TODO: Check if still necessary with timeSprinting change. // TODO: Find more ways to confine conditions. final float yaw = from.getYaw(); if (xDistance < 0D && zDistance > 0D && yaw > 180F && yaw < 270F