From 186eec69ab8f827bd108d9267fab6f78c7784114 Mon Sep 17 00:00:00 2001 From: asofold Date: Mon, 11 Mar 2013 19:18:22 +0100 Subject: [PATCH] Moving: Only set sfDirty flag if velocity is really used. --- .../nocheatplus/checks/moving/MovingListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 22c03d85..e2442244 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -974,7 +974,9 @@ public class MovingListener extends CheckListener implements TickListener, IRemo if (cc.debug) System.out.println(event.getPlayer().getName() + " new velocity: " + velocity); double newVal = velocity.getY(); + boolean used = false; if (newVal >= 0D) { + used = true; if (data.verticalFreedom <= 0.001 && data.verticalVelocityCounter >= 0){ data.verticalVelocity = 0; } @@ -986,6 +988,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo newVal = Math.sqrt(velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ()); if (newVal > 0D) { + used = true; final Velocity vel = new Velocity(newVal, cc.velocityActivationCounter, 1 + (int) Math.round(newVal * 10.0)); data.addHorizontalVelocity(vel); // data.horizontalFreedom += newVal; @@ -994,7 +997,9 @@ public class MovingListener extends CheckListener implements TickListener, IRemo } // Set dirty flag here. - data.sfDirty = true; + if (used){ + data.sfDirty = true; + } // TODO: clear accounting here ? }