mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-04 23:07:44 +01:00
Attempt to prevent exploits of a workaround.
This commit is contained in:
parent
5dff15002a
commit
390fa3f738
@ -107,6 +107,8 @@ public class MovingData extends ACheckData {
|
|||||||
// public boolean noFallWasOnGround;
|
// public boolean noFallWasOnGround;
|
||||||
/** Last y coordinate from when the player was on ground. */
|
/** Last y coordinate from when the player was on ground. */
|
||||||
public double noFallMaxY;
|
public double noFallMaxY;
|
||||||
|
/** Indicate that NoFall should assume the player to be on ground. */
|
||||||
|
public boolean noFallAssumeGround;
|
||||||
|
|
||||||
// Passable check.
|
// Passable check.
|
||||||
public double passableVL;
|
public double passableVL;
|
||||||
|
@ -305,6 +305,8 @@ public class MovingListener implements Listener {
|
|||||||
|
|
||||||
final MovingData data = MovingData.getData(player);
|
final MovingData data = MovingData.getData(player);
|
||||||
final MovingConfig cc = MovingConfig.getConfig(player);
|
final MovingConfig cc = MovingConfig.getConfig(player);
|
||||||
|
|
||||||
|
data.noFallAssumeGround = false;
|
||||||
|
|
||||||
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
|
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
|
||||||
// general data modifications one for each event.
|
// general data modifications one for each event.
|
||||||
|
@ -114,11 +114,11 @@ public class NoFall extends Check {
|
|||||||
// Just reset.
|
// Just reset.
|
||||||
data.clearNoFallData();
|
data.clearNoFallData();
|
||||||
}
|
}
|
||||||
else if (fromOnGround){
|
else if (fromOnGround || data.noFallAssumeGround){
|
||||||
// Check if to deal damage (fall back damage check).
|
// Check if to deal damage (fall back damage check).
|
||||||
if (cc.noFallDealDamage) handleOnGround(mcPlayer, data, from.getY(), cc);
|
if (cc.noFallDealDamage) handleOnGround(mcPlayer, data, from.getY(), cc);
|
||||||
else{
|
else{
|
||||||
mcPlayer.fallDistance = Math.max(mcPlayer.fallDistance, Math.max(data.noFallFallDistance, (float) (data.noFallMaxY - to.getY())));
|
mcPlayer.fallDistance = Math.max(mcPlayer.fallDistance, Math.max(data.noFallFallDistance, (float) (data.noFallMaxY - from.getY())));
|
||||||
data.clearNoFallData();
|
data.clearNoFallData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,17 +208,18 @@ public class SurvivalFly extends Check {
|
|||||||
// If the player has touched the ground but it hasn't been noticed by the plugin, the workaround is here.
|
// If the player has touched the ground but it hasn't been noticed by the plugin, the workaround is here.
|
||||||
final double setBackYDistance = to.getY() - data.setBack.getY();
|
final double setBackYDistance = to.getY() - data.setBack.getY();
|
||||||
if (!fromOnGround && (from.getY() < data.survivalFlyLastFromY && yDistance > 0D && yDistance < 0.5D
|
if (!fromOnGround && (from.getY() < data.survivalFlyLastFromY && yDistance > 0D && yDistance < 0.5D
|
||||||
&& setBackYDistance > 0D && setBackYDistance <= 1.5D || !toOnGround && to.isAboveStairs())) {
|
&& setBackYDistance > 0D && setBackYDistance <= 1.5D && !BlockProperties.isPassable(from.getTypeIdBelow())
|
||||||
|
|| !toOnGround && to.isAboveStairs())) {
|
||||||
// Set the new setBack and reset the jumpPhase.
|
// Set the new setBack and reset the jumpPhase.
|
||||||
|
|
||||||
// TODO: this allows exploits !
|
// Maybe don't adapt the setback (unless null)!
|
||||||
|
|
||||||
data.setBack = from.getLocation();
|
data.setBack = from.getLocation();
|
||||||
data.setBack.setY(Math.floor(data.setBack.getY()));
|
data.setBack.setY(Math.floor(data.setBack.getY()));
|
||||||
|
|
||||||
data.survivalFlyJumpPhase = 0;
|
data.survivalFlyJumpPhase = 0;
|
||||||
// Reset the no fall data.
|
// Tell NoFall that we assume the player to have been on ground somehow.
|
||||||
data.clearNoFallData();
|
data.noFallAssumeGround = true;
|
||||||
if (cc.debug) System.out.println(player.getName() + " RESET NOFALL (WORKAROUND)");
|
if (cc.debug) System.out.println(player.getName() + " Y INCONSISTENCY WORKAROUND USED");
|
||||||
}
|
}
|
||||||
data.survivalFlyLastFromY = from.getY();
|
data.survivalFlyLastFromY = from.getY();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user