mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-06 10:27:26 +02:00
Change resetting of yOnGround for NoFall.
Use CheckConfig to determine if it is necessary. Move resetting to a method. Collect block flags again.
This commit is contained in:
parent
2b0ab5cae3
commit
8bed6fb2de
@ -77,7 +77,7 @@ public class NoFall extends Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks a player.
|
* Checks a player. Expects from and to using cc.yOnGround.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* the player
|
* the player
|
||||||
@ -97,11 +97,11 @@ public class NoFall extends Check {
|
|||||||
final double oldNFDist = data.noFallFallDistance;
|
final double oldNFDist = data.noFallFallDistance;
|
||||||
|
|
||||||
// Adapt yOnGround if necessary (sf uses another setting).
|
// Adapt yOnGround if necessary (sf uses another setting).
|
||||||
if (yDiff < 0) {
|
if (yDiff < 0 && cc.yOnGround < cc.noFallyOnGround) {
|
||||||
// In fact this is somewhat heuristic, but it seems to work well.
|
// In fact this is somewhat heuristic, but it seems to work well.
|
||||||
// Missing on-ground seems to happen with running down pyramids rather.
|
// Missing on-ground seems to happen with running down pyramids rather.
|
||||||
if (from.getyOnGround() != cc.noFallyOnGround && fromY - from.getBlockY() < cc.noFallyOnGround) from.setyOnGround(cc.noFallyOnGround);
|
// TODO: Should be obsolete.
|
||||||
if (to.getyOnGround() != cc.noFallyOnGround && toY - to.getBlockY() < cc.noFallyOnGround) to.setyOnGround(cc.noFallyOnGround);
|
adjustYonGround(from, to , cc.noFallyOnGround);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Distinguish water depth vs. fall distance!
|
// TODO: Distinguish water depth vs. fall distance!
|
||||||
@ -176,6 +176,23 @@ public class NoFall extends Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set yOnGround for from and to, if needed, should be obsolete.
|
||||||
|
* @param from
|
||||||
|
* @param to
|
||||||
|
* @param cc
|
||||||
|
*/
|
||||||
|
private void adjustYonGround(final PlayerLocation from, final PlayerLocation to, final double yOnGround) {
|
||||||
|
if (!from.isResetCond() && !from.isOnGround()){
|
||||||
|
from.setyOnGround(yOnGround);
|
||||||
|
from.collectBlockFlags(yOnGround);
|
||||||
|
}
|
||||||
|
if (!to.isResetCond() && !to.isOnGround()){
|
||||||
|
to.setyOnGround(yOnGround);
|
||||||
|
to.collectBlockFlags(yOnGround);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Quit or kick: adjust fall distance if necessary.
|
* Quit or kick: adjust fall distance if necessary.
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user