mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-14 03:21:24 +01:00
Reset sprinting if the player is not set sprinting.
Only give the sprintinggrace time concerning the food level. Should fix more sprintback issues, potentially.
This commit is contained in:
parent
63b2cd3156
commit
f82a0c084a
@ -474,13 +474,21 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||
return;
|
||||
}
|
||||
|
||||
final long time = System.currentTimeMillis(); // TODO: pass to checks to use one reference time (set in data)?
|
||||
if (player.isSprinting() && player.getFoodLevel() > 5){
|
||||
final long time = System.currentTimeMillis();
|
||||
if (player.isSprinting()){
|
||||
//
|
||||
if (player.getFoodLevel() > 5){
|
||||
data.timeSprinting = time;
|
||||
}
|
||||
else if (time < data.timeSprinting){
|
||||
data.timeSprinting = 0;
|
||||
}
|
||||
// else: keep sprinting time.
|
||||
}
|
||||
else{
|
||||
// Reset if not actually sprinting.
|
||||
data.timeSprinting = 0;
|
||||
}
|
||||
|
||||
// Prepare locations for use.
|
||||
// TODO: Block flags might not be needed if neither sf nor passable get checked.
|
||||
|
@ -171,6 +171,7 @@ public class SurvivalFly extends Check {
|
||||
|
||||
// Prevent players from sprinting if they're moving backwards.
|
||||
if (sprinting) {
|
||||
// TODO: Check if still necessary with timeSprinting change.
|
||||
// TODO: Find more ways to confine conditions.
|
||||
final float yaw = from.getYaw();
|
||||
if (xDistance < 0D && zDistance > 0D && yaw > 180F && yaw < 270F
|
||||
|
Loading…
Reference in New Issue
Block a user