Fix another Speed false with elytra, fix BoatFly false positive

This commit is contained in:
Rammelkast committed 2021-12-16 16:33:05 +01:00
1 parent 5b33eb5b9d
commit 64788fb1a0
2 files changed
+4 -2

No files matched your search

@@ -27,6 +27,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import com.cryptomorin.xseries.XMaterial;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType;
@@ -52,9 +53,10 @@ public final class BoatFlyCheck {
final Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (player.getVehicle().getType() == EntityType.BOAT) {
final Block bottom = player.getWorld().getBlockAt(to.getBlockX(), to.getBlockY() - 1, to.getBlockZ());
if (!Utilities.cantStandAt(bottom)) {
if (!Utilities.cantStandAt(bottom) || bottom.getType() == XMaterial.WATER.parseMaterial()) {
return PASS;
}
int violations = VIOLATIONS.getOrDefault(uuid, 1);
if (violations++ >= checksConfig.getInteger(CheckType.BOATFLY, "vlBeforeFlag")) {
violations = 0;
@@ -261,7 +261,7 @@ public final class SpeedCheck {
}
// GroundSpeed
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1) {
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1 && movementManager.elytraEffectTicks < 10) {
final double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default
// 0.34
double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks);