mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 18:31:24 +01:00
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:
parent
2257ac2f71
commit
4eefc0c3ff
@ -1003,7 +1003,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
|
|
||||||
double newVal = velocity.getY();
|
double newVal = velocity.getY();
|
||||||
boolean used = false;
|
boolean used = false;
|
||||||
if (newVal >= 0D) {
|
if (newVal >= 0D) { // TODO: Just >, not >=.
|
||||||
used = true;
|
used = true;
|
||||||
if (data.verticalFreedom <= 0.001 && data.verticalVelocityCounter >= 0) {
|
if (data.verticalFreedom <= 0.001 && data.verticalVelocityCounter >= 0) {
|
||||||
data.verticalVelocity = 0;
|
data.verticalVelocity = 0;
|
||||||
|
@ -534,12 +534,6 @@ public class SurvivalFly extends Check {
|
|||||||
else {
|
else {
|
||||||
hAllowedDistance = walkSpeed * modSprint * cc.survivalFlySprintingSpeed / 100D;
|
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).
|
// Account for flowing liquids (only if needed).
|
||||||
@ -550,6 +544,7 @@ public class SurvivalFly extends Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Short cut.
|
// Short cut.
|
||||||
|
// TODO: Check if a) early return makes sense and b) do it ofr all following parts.
|
||||||
if (hDistance <= hAllowedDistance && !cc.debug) {
|
if (hDistance <= hAllowedDistance && !cc.debug) {
|
||||||
// Shortcut for debug disabled.
|
// Shortcut for debug disabled.
|
||||||
return hAllowedDistance;
|
return hAllowedDistance;
|
||||||
@ -566,6 +561,11 @@ public class SurvivalFly extends Check {
|
|||||||
hAllowedDistance *= 1.0D + 0.2D * (speedAmplifier + 1);
|
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;
|
return hAllowedDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,6 +999,7 @@ public class SurvivalFly extends Check {
|
|||||||
// if (vDistanceAboveLimit > 0) tags.add("vclimb");
|
// if (vDistanceAboveLimit > 0) tags.add("vclimb");
|
||||||
final double jumpHeight = 1.35 + (data.jumpAmplifier > 0 ? (0.6 + data.jumpAmplifier - 1.0) : 0.0);
|
final double jumpHeight = 1.35 + (data.jumpAmplifier > 0 ? (0.6 + data.jumpAmplifier - 1.0) : 0.0);
|
||||||
// TODO: ladders are ground !
|
// TODO: ladders are ground !
|
||||||
|
// TODO: yDistance < 0.0 ?
|
||||||
if (yDistance > climbSpeed && !from.isOnGround(jumpHeight, 0D, 0D, BlockProperties.F_CLIMBABLE)) {
|
if (yDistance > climbSpeed && !from.isOnGround(jumpHeight, 0D, 0D, BlockProperties.F_CLIMBABLE)) {
|
||||||
// Ignore ladders. TODO: Check for false positives...
|
// Ignore ladders. TODO: Check for false positives...
|
||||||
tags.add("climbspeed");
|
tags.add("climbspeed");
|
||||||
|
Loading…
Reference in New Issue
Block a user