mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-02 00:29:59 +01:00
Fix nofall check
This commit is contained in:
parent
bf7ac37cb1
commit
c4861eeed9
@ -31,4 +31,6 @@ public interface NoCheatPlayer {
|
||||
|
||||
public ExecutionHistory getExecutionHistory();
|
||||
|
||||
public void dealFallDamage();
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cc.co.evenprime.bukkit.nocheat.checks.moving;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
||||
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
|
||||
import cc.co.evenprime.bukkit.nocheat.actions.ParameterName;
|
||||
@ -32,12 +31,16 @@ public class NoFallCheck extends MovingCheck {
|
||||
data.lastAddedFallDistance = 0F;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// This check is pretty much always a step behind for technical reasons.
|
||||
if(data.fromOnOrInGround) {
|
||||
// Start with zero fall distance
|
||||
data.fallDistance = 0F;
|
||||
}
|
||||
|
||||
if(data.fromOnOrInGround && data.toOnOrInGround && data.from.y <= data.to.y && player.getPlayer().getFallDistance() > 2.0F) {
|
||||
player.dealFallDamage();
|
||||
}
|
||||
|
||||
// If we increased fall height before for no good reason, reduce now by
|
||||
// the same amount
|
||||
|
@ -117,4 +117,11 @@ public class NoCheatPlayerImpl implements NoCheatPlayer {
|
||||
public ExecutionHistory getExecutionHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage() {
|
||||
EntityPlayer p = ((CraftPlayer) player).getHandle();
|
||||
p.b(0D, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user