Update to 1.16.5, found code issue that caused #119, patched #128

This commit is contained in:
Rammelkast committed 2021-01-23 11:55:12 +01:00
1 parent 7f9d3c1396
commit 6f5cd70ba3
7 files changed
+68 -39

No files matched your search

@@ -44,7 +44,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class FlightCheck {
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
public static final Map<UUID, Integer> GRAVITY_VIOLATIONS = new HashMap<UUID, Integer>();
public static final Map<UUID, Float> GRAVITY_VIOLATIONS = new HashMap<UUID, Float>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
private static final double GRAVITY_FRICTION = 0.9800000190734863D;
@@ -135,7 +135,8 @@ public class FlightCheck {
&& (!Utilities.isNearBed(distance.getTo()) || ((Utilities.isNearBed(distance.getTo())
|| Utilities.isNearBed(distance.getTo().clone().add(0, -0.51, 0)))
&& movementManager.motionY > 0.15))
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25)
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25
&& !Utilities.couldBeOnBoat(player))
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
"tried to climb air (mY=" + movementManager.motionY + ")");
@@ -150,6 +151,16 @@ public class FlightCheck {
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
}
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.airTicks >= minAirTicks
&& movementManager.lastMotionY < 0 && movementManager.motionY > 0
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
&& movementManager.elytraEffectTicks <= 25
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))) {
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
}
// End AirClimb
// Start GroundFlight
@@ -178,7 +189,7 @@ public class FlightCheck {
&& distance.getTo().clone().subtract(0, 0.5, 0).getBlock().getType() != Material.AIR))
maxOffset += 0.15D;
if (offset > maxOffset && movementManager.airTicks > 2) {
int vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
float vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0f) + 1;
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
if (vl >= vlBeforeFlag) {
@@ -187,7 +198,10 @@ public class FlightCheck {
"ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
}
} else {
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
if (GRAVITY_VIOLATIONS.containsKey(player.getUniqueId())) {
float vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0f);
GRAVITY_VIOLATIONS.put(player.getUniqueId(), Math.max(0, vl - 0.5f));
}
}
}
// End Gravity
@@ -208,11 +208,6 @@ public class SpeedCheck {
limit *= 1.4D;
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect)
limit *= 1.2D;
// Other speed increasing effects (idk why, bloody Bukkt..)
if (movementManager.hasIncreasingEffect && movementManager.groundTicks > 3)
limit *= 1.12D;
if (movementManager.hadIncreasingEffect && !movementManager.hasIncreasingEffect)
limit *= 1.08D;
if (movementManager.iceInfluenceTicks >= 50) {
// When moving off ice
if (!Utilities.couldBeOnIce(movingTowards))