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.
This commit is contained in:
asofold 2014-07-25 18:51:18 +02:00
parent 2257ac2f71
commit 4eefc0c3ff
2 changed files with 8 additions and 7 deletions

View File

@ -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;

View File

@ -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");