mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-31 21:07:50 +01:00
Add method for reset condition to PlayerLocation.
This commit is contained in:
parent
fdd5bf3b58
commit
b531091e7f
@ -99,9 +99,9 @@ public class NoFall extends Check {
|
||||
// TODO: Distinguish water depth vs. fall distance!
|
||||
|
||||
final boolean fromOnGround = from.isOnGround();
|
||||
final boolean fromReset = from.isInLiquid() || from.isInWeb() || from.isOnLadder();
|
||||
final boolean fromReset = from.isResetCond();
|
||||
final boolean toOnGround = to.isOnGround();
|
||||
final boolean toReset = to.isInLiquid() || to.isInWeb() || to.isOnLadder();
|
||||
final boolean toReset = to.isResetCond();
|
||||
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class SurvivalFly extends Check {
|
||||
final boolean resetFrom;
|
||||
|
||||
// "Lost ground" workaround.
|
||||
if (fromOnGround || from.isInLiquid() || from.isOnLadder() || from.isInWeb()) resetFrom = true;
|
||||
if (fromOnGround || from.isResetCond()) resetFrom = true;
|
||||
else if (lostGround(player, mcPlayer, from, to, yDistance, data, cc)){
|
||||
resetFrom = true;
|
||||
// TODO: Consider && !resetTo ?
|
||||
@ -189,7 +189,7 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
|
||||
|
||||
final boolean resetTo = toOnGround || to.isInLiquid() || to.isOnLadder() || to.isInWeb();
|
||||
final boolean resetTo = toOnGround || to.isResetCond();
|
||||
|
||||
if (cc.survivalFlyAccountingH && !resetFrom && !resetTo) {
|
||||
// Currently only for "air" phases.
|
||||
|
@ -358,6 +358,15 @@ public class PlayerLocation {
|
||||
}
|
||||
return onGround;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset condition for flying checks (sf + nofall): fluids, web, ladder (not on-ground, though).
|
||||
* @return
|
||||
*/
|
||||
public boolean isResetCond(){
|
||||
// NOTE: if optimizing, setYOnGround has to be kept in mind.
|
||||
return isInLiquid() || isOnLadder() || isInWeb();
|
||||
}
|
||||
|
||||
public double getyOnGround() {
|
||||
return yOnGround;
|
||||
|
Loading…
Reference in New Issue
Block a user