mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-06 18:50:54 +01:00
Looking once over set-back + nofall.
This commit is contained in:
parent
ba1954025d
commit
f6aaf52d03
@ -229,17 +229,17 @@ public class MovingListener extends CheckListener{
|
||||
target.setPitch(loc.getPitch());
|
||||
target.setYaw(loc.getYaw());
|
||||
if (target != null){
|
||||
if (noFall.isEnabled(player)){
|
||||
if (noFall.isEnabled(player) && shouldCheckSurvivalFly(player, data, MovingConfig.getConfig(player))){
|
||||
// Check if to deal damage.
|
||||
noFall.checkDamage(player, data);
|
||||
double y = loc.getY();
|
||||
if (data.setBack != null) y = Math.min(y, data.setBack.getY());
|
||||
noFall.checkDamage(player, data, y);
|
||||
}
|
||||
// Teleport.
|
||||
data.teleported = target;
|
||||
player.teleport(target);// TODO: schedule / other measures ?
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -397,13 +397,19 @@ public class MovingListener extends CheckListener{
|
||||
newTo = survivalFly.check(player, mcPlayer, pFrom, pTo, data, cc);
|
||||
// Check NoFall if no reset is done.
|
||||
if (cc.noFallCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_NOFALL) && !player.hasPermission(Permissions.MOVING_NOFALL)) {
|
||||
if (newTo == null) {
|
||||
if (passableTo != null){
|
||||
// Deal damage if necessary.
|
||||
// Leaving out: player.getLocation().getY()
|
||||
noFall.checkDamage(player, data, Math.min(from.getY(), to.getY()));
|
||||
}
|
||||
else if (newTo == null) {
|
||||
// NOTE: noFall might set yOnGround for the positions.
|
||||
noFall.check(player, pFrom, pTo, data, cc);
|
||||
}
|
||||
else{
|
||||
// Deal damage if necessary.
|
||||
noFall.checkDamage(player, data);
|
||||
// Leaving out: player.getLocation().getY()
|
||||
noFall.checkDamage(player, data, Math.min(from.getY(), to.getY()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,11 +201,11 @@ public class NoFall extends Check {
|
||||
* @param player
|
||||
* @param data
|
||||
*/
|
||||
public void checkDamage(final Player player, final MovingData data) {
|
||||
public void checkDamage(final Player player, final MovingData data, final double y) {
|
||||
final MovingConfig cc = MovingConfig.getConfig(player);
|
||||
// Get the max difference for fall distance.
|
||||
final float fallDistance = player.getFallDistance();
|
||||
final float yDiff = (float) (data.noFallMaxY - player.getLocation().getY());
|
||||
final float yDiff = (float) (data.noFallMaxY - y);
|
||||
final double maxDiff = Math.max(yDiff, Math.max(data.noFallFallDistance, fallDistance));
|
||||
// Calculate damage that would be dealt (plus return if none).
|
||||
final int damage = NoFall.getDamage((float) maxDiff);
|
||||
|
Loading…
Reference in New Issue
Block a user