mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
Add more information to speed messages
This commit is contained in:
1 parent
7d152c9d33
commit
6983c8a5bf
1 file changed
+9
-9
@@ -287,32 +287,32 @@ 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) {
|
if (!isSpeedExempt(player) && player.getVehicle() == null) {
|
||||||
boolean speed = false;
|
|
||||||
String reason = "";
|
String reason = "";
|
||||||
|
double max = magic.XZ_SPEED_MAX;
|
||||||
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
||||||
if (player.isSprinting()) {
|
if (player.isSprinting()) {
|
||||||
reason = "on soulsand while sprinting ";
|
reason = "on soulsand while sprinting ";
|
||||||
speed = x > magic.XZ_SPEED_MAX_SOULSAND_SPRINT || z > magic.XZ_SPEED_MAX_SOULSAND_SPRINT;
|
max = magic.XZ_SPEED_MAX_SOULSAND_SPRINT;
|
||||||
} else {
|
} else {
|
||||||
reason = "on soulsand ";
|
reason = "on soulsand ";
|
||||||
speed = x > magic.XZ_SPEED_MAX_SOULSAND || z > magic.XZ_SPEED_MAX_SOULSAND;
|
max = magic.XZ_SPEED_MAX_SOULSAND;
|
||||||
}
|
}
|
||||||
} else if (player.isFlying()) {
|
} else if (player.isFlying()) {
|
||||||
reason = "while flying ";
|
reason = "while flying ";
|
||||||
speed = x > magic.XZ_SPEED_MAX_FLY || z > magic.XZ_SPEED_MAX_FLY;
|
max = magic.XZ_SPEED_MAX_FLY;
|
||||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
reason = "with speed potion ";
|
reason = "with speed potion ";
|
||||||
speed = x > magic.XZ_SPEED_MAX_POTION || z > magic.XZ_SPEED_MAX_POTION;
|
max = magic.XZ_SPEED_MAX_POTION;
|
||||||
} else if (player.isSprinting()) {
|
} else if (player.isSprinting()) {
|
||||||
reason = "while sprinting ";
|
reason = "while sprinting ";
|
||||||
speed = x > magic.XZ_SPEED_MAX_SPRINT || z > magic.XZ_SPEED_MAX_SPRINT;
|
max = magic.XZ_SPEED_MAX_SPRINT;
|
||||||
} else {
|
} else {
|
||||||
speed = x > magic.XZ_SPEED_MAX || z > magic.XZ_SPEED_MAX;
|
max = magic.XZ_SPEED_MAX;
|
||||||
}
|
}
|
||||||
if (speed) {
|
if (x > max || z > max) {
|
||||||
int num = this.increment(player, speedViolation, magic.SPEED_MAX);
|
int num = this.increment(player, speedViolation, magic.SPEED_MAX);
|
||||||
if(num >= magic.SPEED_MAX) {
|
if(num >= magic.SPEED_MAX) {
|
||||||
return new CheckResult(Result.FAILED, player.getName()+"'s speed was too high "+reason+num+" times in a row (max="+magic.SPEED_MAX+")");
|
return new CheckResult(Result.FAILED, player.getName()+"'s speed was too high "+reason+num+" times in a row (max="+magic.SPEED_MAX+", speed="+(x > z ? x : z)+", max speed="+max+")");
|
||||||
} else {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user