mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Only apply speed boost if walk speed is positive
Having a negative entity walk speed need not decrease the max calculated speed
This commit is contained in:
1 parent
8773f53936
commit
17342721f1
2 files changed
+3
-5
No files matched your search
@@ -295,7 +295,7 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkXZSpeed(Player player, double x, double z) {
|
public CheckResult checkXZSpeed(Player player, double x, double z) {
|
||||||
if (!isSpeedExempt(player) && player.getVehicle() == null && player.getWalkSpeed() > 0) {
|
if (!isSpeedExempt(player) && player.getVehicle() == null) {
|
||||||
String reason = "";
|
String reason = "";
|
||||||
double max = magic.XZ_SPEED_MAX;
|
double max = magic.XZ_SPEED_MAX;
|
||||||
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
||||||
@@ -320,7 +320,8 @@ public class Backend {
|
|||||||
max = magic.XZ_SPEED_MAX_SPRINT;
|
max = magic.XZ_SPEED_MAX_SPRINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
max += player.getWalkSpeed() - 0.2f;
|
float speed = player.getWalkSpeed();
|
||||||
|
max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;
|
||||||
|
|
||||||
if (x > max || z > max) {
|
if (x > max || z > max) {
|
||||||
int num = this.increment(player, speedViolation, magic.SPEED_MAX);
|
int num = this.increment(player, speedViolation, magic.SPEED_MAX);
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ package net.h31ix.anticheat.util;
|
|||||||
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic number class. Modifications to values in magic.yml will be accepted here.
|
* Magic number class. Modifications to values in magic.yml will be accepted here.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
Reference in new issue
Block a user