mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-03 19:00:30 +02:00
Add comments, reorder slightly.
This commit is contained in:
parent
7399bfa8ee
commit
261fca021d
|
@ -76,6 +76,7 @@ public class CreativeFly extends Check {
|
|||
final double speedModifier = mcAccess.getFasterMovementAmplifier(player);
|
||||
final double fSpeed;
|
||||
|
||||
// TODO: Make this configurable ! [Speed effect should not affect flying if not on ground.]
|
||||
if (speedModifier == Double.NEGATIVE_INFINITY) fSpeed = 1D;
|
||||
else fSpeed = 1D + 0.2D * (speedModifier + 1D);
|
||||
|
||||
|
@ -88,25 +89,29 @@ public class CreativeFly extends Check {
|
|||
|
||||
data.bunnyhopDelay--;
|
||||
|
||||
if (resultH > 0 && sprinting)
|
||||
if (resultH > 0 && sprinting){
|
||||
// TODO: Flying and bunnyhop ? <- 8 blocks per second - could be a case.
|
||||
// Try to treat it as a the "bunnyhop" problem. The bunnyhop problem is that landing and immediately jumping
|
||||
// again leads to a player moving almost twice as far in that step.
|
||||
if (data.bunnyhopDelay <= 0 && resultH < 0.4D) {
|
||||
data.bunnyhopDelay = 9;
|
||||
resultH = 0D;
|
||||
}
|
||||
}
|
||||
|
||||
resultH *= 100D;
|
||||
|
||||
final double limitV = cc.creativeFlyVerticalSpeed / 100D * VERTICAL_SPEED; // * data.jumpAmplifier;
|
||||
|
||||
// Super simple, just check distance compared to max distance vertical.
|
||||
// TODO: max descending speed ! [max fall speed, use maximum with speed or added ?]
|
||||
final double resultV = Math.max(0D, yDistance - data.verticalFreedom - limitV) * 100D;
|
||||
|
||||
final double result = resultH + resultV;
|
||||
|
||||
// The player went to far, either horizontal or vertical.
|
||||
if (result > 0D) {
|
||||
// TODO: Get rid of creativeFlyPreviousRefused.
|
||||
if (data.creativeFlyPreviousRefused) {
|
||||
// Increment violation level.
|
||||
data.creativeFlyVL += result;
|
||||
|
|
|
@ -74,29 +74,42 @@ public class MovingData extends ACheckData {
|
|||
*/
|
||||
private static final MediumLiftOff defaultMediumLiftOff = MediumLiftOff.LIMIT_JUMP;
|
||||
|
||||
// Violation levels.
|
||||
// Violation levels -----
|
||||
public double creativeFlyVL = 0D;
|
||||
public double morePacketsVL = 0D;
|
||||
public double morePacketsVehicleVL = 0D;
|
||||
public double noFallVL = 0D;
|
||||
public double survivalFlyVL = 0D;
|
||||
|
||||
// Data shared between the fly checks.
|
||||
// Data shared between the fly checks -----
|
||||
public int bunnyhopDelay;
|
||||
public double horizontalFreedom;
|
||||
public double jumpAmplifier;
|
||||
|
||||
// Velocity handling.
|
||||
// TODO: consider resetting these with clearFlyData and onSetBack.
|
||||
public double verticalFreedom;
|
||||
public double horizontalVelocityCounter;
|
||||
public double verticalVelocity;
|
||||
public int verticalVelocityCounter;
|
||||
public double horizontalVelocityCounter;
|
||||
public double horizontalFreedom;
|
||||
|
||||
// Coordinates.
|
||||
/** Last from coordinates. */
|
||||
public double fromX = Double.MAX_VALUE, fromY, fromZ;
|
||||
/** Last to coordinates. */
|
||||
public double toX = Double.MAX_VALUE, toY, toZ;
|
||||
|
||||
// sf rather
|
||||
/** To/from was ground or web or assumed to be etc. */
|
||||
public boolean toWasReset, fromWasReset;
|
||||
public MediumLiftOff mediumLiftOff = defaultMediumLiftOff;
|
||||
|
||||
// Locations shared between all checks.
|
||||
private Location setBack = null;
|
||||
private Location teleported = null;
|
||||
|
||||
// Check specific data -----
|
||||
|
||||
// Data of the creative check.
|
||||
public boolean creativeFlyPreviousRefused;
|
||||
|
||||
|
@ -117,8 +130,6 @@ public class MovingData extends ACheckData {
|
|||
|
||||
// Data of the no fall check.
|
||||
public float noFallFallDistance = 0;
|
||||
// public boolean noFallOnGround;
|
||||
// public boolean noFallWasOnGround;
|
||||
/** Last y coordinate from when the player was on ground. */
|
||||
public double noFallMaxY = 0;
|
||||
/** Indicate that NoFall should assume the player to be on ground. */
|
||||
|
@ -145,16 +156,8 @@ public class MovingData extends ACheckData {
|
|||
public long sfVLTime = 0;
|
||||
|
||||
// Accounting info.
|
||||
// TODO: optimize later.
|
||||
// public final ActionFrequency hDistCount = new ActionFrequency(3, 333);
|
||||
// public final ActionFrequency hDistSum = new ActionFrequency(3, 333);
|
||||
public final ActionAccumulator vDistAcc = new ActionAccumulator(3, 3);
|
||||
// public final ActionFrequency vDistSum = new ActionFrequency(3, 333);
|
||||
// public final ActionFrequency vDistCount = new ActionFrequency(3, 333);
|
||||
|
||||
// Locations shared between all checks.
|
||||
private Location setBack = null;
|
||||
private Location teleported = null;
|
||||
|
||||
/**
|
||||
* Clear the data of the fly checks (not more-packets).
|
||||
|
|
Loading…
Reference in New Issue
Block a user