mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-26 10:28:05 +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,11 +474,19 @@ 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){
|
||||
data.timeSprinting = time;
|
||||
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 if (time < data.timeSprinting){
|
||||
else{
|
||||
// Reset if not actually sprinting.
|
||||
data.timeSprinting = 0;
|
||||
}
|
||||
|
||||
|
@ -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