mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-30 20:37:52 +01:00
Bleeding: SF: Prevent VL reduction if last violation was within two
seconds.
This commit is contained in:
parent
2e812f17f8
commit
85848c6f72
@ -94,6 +94,7 @@ public class MovingConfig extends ACheckConfig {
|
||||
public final int survivalFlyWalkingSpeed;
|
||||
public final boolean survivalFlyCobwebHack;
|
||||
public final boolean survivalFlyAccounting;
|
||||
public final long survivalFlyVLFreeze;
|
||||
public final ActionList survivalFlyActions;
|
||||
|
||||
// Special tolerance values:
|
||||
@ -143,6 +144,7 @@ public class MovingConfig extends ACheckConfig {
|
||||
survivalFlyWalkingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100);
|
||||
survivalFlyCobwebHack = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true);
|
||||
survivalFlyAccounting = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_ACCOUNTING);
|
||||
survivalFlyVLFreeze = data.getLong(ConfPaths.MOVING_SURVIVALFLY_VLFREEZE, 2000L);
|
||||
survivalFlyActions = data.getActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, Permissions.MOVING_SURVIVALFLY);
|
||||
|
||||
yOnGround = data.getDouble(ConfPaths.MOVING_YONGROUND, 0.001, 2.0, 0.0626); // sqrt(1/256), see: NetServerHandler.
|
||||
|
@ -125,6 +125,7 @@ public class MovingData extends ACheckData {
|
||||
public boolean survivalFlyWasInBed;
|
||||
public long survivalFlyCobwebTime;
|
||||
public double survivalFlyCobwebVL;
|
||||
public long survivalFlyVLTime;
|
||||
|
||||
// Accounting info.
|
||||
// TODO: optimize later.
|
||||
@ -138,7 +139,6 @@ public class MovingData extends ACheckData {
|
||||
public Location setBack;
|
||||
public Location teleported;
|
||||
|
||||
|
||||
/**
|
||||
* Clear the data of the fly checks (not more-packets).
|
||||
*/
|
||||
|
@ -332,9 +332,6 @@ public class SurvivalFly extends Check {
|
||||
final double result = (Math.max(hDistanceAboveLimit, 0D) + Math.max(vDistanceAboveLimit, 0D)) * 100D;
|
||||
|
||||
data.survivalFlyJumpPhase++;
|
||||
|
||||
// Slowly reduce the level with each event.
|
||||
data.survivalFlyVL *= 0.95D;
|
||||
|
||||
if (cc.debug){
|
||||
System.out.println(player.getName() + " vertical freedom: " + data.verticalFreedom + " ("+data.verticalVelocity+"/"+data.verticalVelocityCounter+"), jumpphase: " + data.survivalFlyJumpPhase);
|
||||
@ -358,6 +355,7 @@ public class SurvivalFly extends Check {
|
||||
vd.setParameter(ParameterName.LOCATION_TO, String.format(Locale.US, "%.2f, %.2f, %.2f", to.getX(), to.getY(), to.getZ()));
|
||||
vd.setParameter(ParameterName.DISTANCE, String.format(Locale.US, "%.2f", to.getLocation().distance(from.getLocation())));
|
||||
}
|
||||
data.survivalFlyVLTime = now;
|
||||
if (executeActions(vd)){
|
||||
data.survivalFlyLastYDist = Double.MAX_VALUE;
|
||||
// Compose a new location based on coordinates of "newTo" and viewing direction of "event.getTo()" to
|
||||
@ -366,6 +364,11 @@ public class SurvivalFly extends Check {
|
||||
to.getYaw(), to.getPitch());
|
||||
}
|
||||
}
|
||||
else{
|
||||
// Slowly reduce the level with each event, if violations have not recently happened.
|
||||
if (now - data.survivalFlyVLTime > cc.survivalFlyVLFreeze) data.survivalFlyVL *= 0.95D;
|
||||
}
|
||||
|
||||
// Violation or not, apply reset conditions (cancel would have returned above).
|
||||
final boolean resetTo = toOnGround || to.isInLiquid() || to.isOnLadder()|| to.isInWeb();
|
||||
if (resetTo){
|
||||
|
@ -469,6 +469,7 @@ public abstract class ConfPaths {
|
||||
public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_COBWEBHACK = MOVING_SURVIVALFLY + "cobwebhack";
|
||||
public static final String MOVING_SURVIVALFLY_ACCOUNTING = MOVING_SURVIVALFLY + "accounting";
|
||||
public static final String MOVING_SURVIVALFLY_VLFREEZE = MOVING_SURVIVALFLY + "vlfreeze";
|
||||
public static final String MOVING_SURVIVALFLY_ACTIONS = MOVING_SURVIVALFLY + "actions";
|
||||
|
||||
// Special (to be sorted in or factored out).
|
||||
|
Loading…
Reference in New Issue
Block a user