diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java b/src/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java index be4538af..6fa2e8e3 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java @@ -94,6 +94,7 @@ public class MovingConfig extends ACheckConfig { public final int survivalFlyWalkingSpeed; public final boolean survivalFlyCobwebHack; public final boolean survivalFlyAccounting; + public final long survivalFlyVLFreeze; public final ActionList survivalFlyActions; // Special tolerance values: @@ -143,6 +144,7 @@ public class MovingConfig extends ACheckConfig { survivalFlyWalkingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100); survivalFlyCobwebHack = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true); survivalFlyAccounting = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_ACCOUNTING); + survivalFlyVLFreeze = data.getLong(ConfPaths.MOVING_SURVIVALFLY_VLFREEZE, 2000L); survivalFlyActions = data.getActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, Permissions.MOVING_SURVIVALFLY); yOnGround = data.getDouble(ConfPaths.MOVING_YONGROUND, 0.001, 2.0, 0.0626); // sqrt(1/256), see: NetServerHandler. diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java b/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java index ce2bbd71..59a728d1 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MovingData.java @@ -125,6 +125,7 @@ public class MovingData extends ACheckData { public boolean survivalFlyWasInBed; public long survivalFlyCobwebTime; public double survivalFlyCobwebVL; + public long survivalFlyVLTime; // Accounting info. // TODO: optimize later. @@ -138,7 +139,6 @@ public class MovingData extends ACheckData { public Location setBack; public Location teleported; - /** * Clear the data of the fly checks (not more-packets). */ diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index 2591ba11..87b71f8c 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -332,9 +332,6 @@ public class SurvivalFly extends Check { final double result = (Math.max(hDistanceAboveLimit, 0D) + Math.max(vDistanceAboveLimit, 0D)) * 100D; data.survivalFlyJumpPhase++; - - // Slowly reduce the level with each event. - data.survivalFlyVL *= 0.95D; if (cc.debug){ System.out.println(player.getName() + " vertical freedom: " + data.verticalFreedom + " ("+data.verticalVelocity+"/"+data.verticalVelocityCounter+"), jumpphase: " + data.survivalFlyJumpPhase); @@ -358,6 +355,7 @@ public class SurvivalFly extends Check { vd.setParameter(ParameterName.LOCATION_TO, String.format(Locale.US, "%.2f, %.2f, %.2f", to.getX(), to.getY(), to.getZ())); vd.setParameter(ParameterName.DISTANCE, String.format(Locale.US, "%.2f", to.getLocation().distance(from.getLocation()))); } + data.survivalFlyVLTime = now; if (executeActions(vd)){ data.survivalFlyLastYDist = Double.MAX_VALUE; // Compose a new location based on coordinates of "newTo" and viewing direction of "event.getTo()" to @@ -366,6 +364,11 @@ public class SurvivalFly extends Check { to.getYaw(), to.getPitch()); } } + else{ + // Slowly reduce the level with each event, if violations have not recently happened. + if (now - data.survivalFlyVLTime > cc.survivalFlyVLFreeze) data.survivalFlyVL *= 0.95D; + } + // Violation or not, apply reset conditions (cancel would have returned above). final boolean resetTo = toOnGround || to.isInLiquid() || to.isOnLadder()|| to.isInWeb(); if (resetTo){ diff --git a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java index 4dbab3bf..6791b89e 100644 --- a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -469,6 +469,7 @@ public abstract class ConfPaths { public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed"; public static final String MOVING_SURVIVALFLY_COBWEBHACK = MOVING_SURVIVALFLY + "cobwebhack"; public static final String MOVING_SURVIVALFLY_ACCOUNTING = MOVING_SURVIVALFLY + "accounting"; + public static final String MOVING_SURVIVALFLY_VLFREEZE = MOVING_SURVIVALFLY + "vlfreeze"; public static final String MOVING_SURVIVALFLY_ACTIONS = MOVING_SURVIVALFLY + "actions"; // Special (to be sorted in or factored out).