From 4eefc0c3ffa2a8c6d54b6e9a3673d469d8e6f35e Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 25 Jul 2014 18:51:18 +0200 Subject: [PATCH] Check speeding permission in the end, thus it will apply to all speeds. This way, using the speeding permission as a workaround for all individual speeds is possible. A player moving faster than default will likely move faster in web too, and so on. There seems to be little reason for keeping it confined to walking + sprinting only. Moving it to the end also allows a quicker return for walking and sprinting, though that policy might be questionable as well, because some calculations might use hAllowedDistance, subject to review. --- .../nocheatplus/checks/moving/MovingListener.java | 2 +- .../nocheatplus/checks/moving/SurvivalFly.java | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) 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 f39c8ab8..ca1cc8e8 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 @@ -1003,7 +1003,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo double newVal = velocity.getY(); boolean used = false; - if (newVal >= 0D) { + if (newVal >= 0D) { // TODO: Just >, not >=. used = true; if (data.verticalFreedom <= 0.001 && data.verticalVelocityCounter >= 0) { data.verticalVelocity = 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 22e35e54..6f5e5398 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 @@ -534,12 +534,6 @@ public class SurvivalFly extends Check { else { hAllowedDistance = walkSpeed * modSprint * cc.survivalFlySprintingSpeed / 100D; } - - // Speeding bypass permission (can be combined with other bypasses). - // TODO: How exactly to bring it on finally. - if (checkPermissions && player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPEEDING)) { - hAllowedDistance *= cc.survivalFlySpeedingSpeed / 100D; - } } // Account for flowing liquids (only if needed). @@ -550,6 +544,7 @@ public class SurvivalFly extends Check { } // Short cut. + // TODO: Check if a) early return makes sense and b) do it ofr all following parts. if (hDistance <= hAllowedDistance && !cc.debug) { // Shortcut for debug disabled. return hAllowedDistance; @@ -566,6 +561,11 @@ public class SurvivalFly extends Check { hAllowedDistance *= 1.0D + 0.2D * (speedAmplifier + 1); } + // Speeding bypass permission (can be combined with other bypasses). + if (checkPermissions && player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPEEDING)) { + hAllowedDistance *= cc.survivalFlySpeedingSpeed / 100D; + } + return hAllowedDistance; } @@ -999,6 +999,7 @@ public class SurvivalFly extends Check { // if (vDistanceAboveLimit > 0) tags.add("vclimb"); final double jumpHeight = 1.35 + (data.jumpAmplifier > 0 ? (0.6 + data.jumpAmplifier - 1.0) : 0.0); // TODO: ladders are ground ! + // TODO: yDistance < 0.0 ? if (yDistance > climbSpeed && !from.isOnGround(jumpHeight, 0D, 0D, BlockProperties.F_CLIMBABLE)) { // Ignore ladders. TODO: Check for false positives... tags.add("climbspeed");