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:
h31ix committed 2013-07-01 02:45:22 -04:00
1 parent 8773f53936
commit 17342721f1
2 files changed
+4 -6

No files matched your search

@@ -295,7 +295,7 @@ public class Backend {
}
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 = "";
double max = magic.XZ_SPEED_MAX;
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
@@ -319,8 +319,9 @@ public class Backend {
reason = "while sprinting ";
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) {
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 java.lang.reflect.Field;
import java.lang.reflect.Modifier;
/**
* Magic number class. Modifications to values in magic.yml will be accepted here.
* <p>