mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-19 10:21:27 +02: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.setPitch(loc.getPitch());
|
||||||
target.setYaw(loc.getYaw());
|
target.setYaw(loc.getYaw());
|
||||||
if (target != null){
|
if (target != null){
|
||||||
if (noFall.isEnabled(player)){
|
if (noFall.isEnabled(player) && shouldCheckSurvivalFly(player, data, MovingConfig.getConfig(player))){
|
||||||
// Check if to deal damage.
|
// 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.
|
// Teleport.
|
||||||
data.teleported = target;
|
data.teleported = target;
|
||||||
player.teleport(target);// TODO: schedule / other measures ?
|
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);
|
newTo = survivalFly.check(player, mcPlayer, pFrom, pTo, data, cc);
|
||||||
// Check NoFall if no reset is done.
|
// Check NoFall if no reset is done.
|
||||||
if (cc.noFallCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_NOFALL) && !player.hasPermission(Permissions.MOVING_NOFALL)) {
|
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.
|
// NOTE: noFall might set yOnGround for the positions.
|
||||||
noFall.check(player, pFrom, pTo, data, cc);
|
noFall.check(player, pFrom, pTo, data, cc);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// Deal damage if necessary.
|
// 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 player
|
||||||
* @param data
|
* @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);
|
final MovingConfig cc = MovingConfig.getConfig(player);
|
||||||
// Get the max difference for fall distance.
|
// Get the max difference for fall distance.
|
||||||
final float fallDistance = player.getFallDistance();
|
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));
|
final double maxDiff = Math.max(yDiff, Math.max(data.noFallFallDistance, fallDistance));
|
||||||
// Calculate damage that would be dealt (plus return if none).
|
// Calculate damage that would be dealt (plus return if none).
|
||||||
final int damage = NoFall.getDamage((float) maxDiff);
|
final int damage = NoFall.getDamage((float) maxDiff);
|
||||||
|
Loading…
Reference in New Issue
Block a user