mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-05 23:37:34 +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!
|
// TODO: Distinguish water depth vs. fall distance!
|
||||||
|
|
||||||
final boolean fromOnGround = from.isOnGround();
|
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 toOnGround = to.isOnGround();
|
||||||
final boolean toReset = to.isInLiquid() || to.isInWeb() || to.isOnLadder();
|
final boolean toReset = to.isResetCond();
|
||||||
|
|
||||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public class SurvivalFly extends Check {
|
|||||||
final boolean resetFrom;
|
final boolean resetFrom;
|
||||||
|
|
||||||
// "Lost ground" workaround.
|
// "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)){
|
else if (lostGround(player, mcPlayer, from, to, yDistance, data, cc)){
|
||||||
resetFrom = true;
|
resetFrom = true;
|
||||||
// TODO: Consider && !resetTo ?
|
// 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) {
|
if (cc.survivalFlyAccountingH && !resetFrom && !resetTo) {
|
||||||
// Currently only for "air" phases.
|
// Currently only for "air" phases.
|
||||||
|
@ -359,6 +359,15 @@ public class PlayerLocation {
|
|||||||
return onGround;
|
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() {
|
public double getyOnGround() {
|
||||||
return yOnGround;
|
return yOnGround;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user