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