mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Fix wrong output on fastbreak message and ensure player isn't in a vehicle before running sneak check
This commit is contained in:
1 parent
2b4c3d8d84
commit
11d9afaec8
1 file changed
+4
-3
@@ -324,7 +324,7 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkSneak(Player player, double x, double z) {
|
public CheckResult checkSneak(Player player, double x, double z) {
|
||||||
if (player.isSneaking() && !player.isFlying() && !isMovingExempt(player)) {
|
if (player.isSneaking() && !player.isFlying() && !isMovingExempt(player) && !player.isInsideVehicle()) {
|
||||||
double i = x > magic.XZ_SPEED_MAX_SNEAK ? x : z > magic.XZ_SPEED_MAX_SNEAK ? z : -1;
|
double i = x > magic.XZ_SPEED_MAX_SNEAK ? x : z > magic.XZ_SPEED_MAX_SNEAK ? z : -1;
|
||||||
if(i != -1) {
|
if(i != -1) {
|
||||||
return new CheckResult(Result.FAILED, player.getName()+" was sneaking too fast (speed="+i+", max="+magic.XZ_SPEED_MAX_SNEAK+")");
|
return new CheckResult(Result.FAILED, player.getName()+" was sneaking too fast (speed="+i+", max="+magic.XZ_SPEED_MAX_SNEAK+")");
|
||||||
@@ -635,12 +635,13 @@ public class Backend {
|
|||||||
fastBreakViolation.put(name, 0);
|
fastBreakViolation.put(name, 0);
|
||||||
} else {
|
} else {
|
||||||
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
|
Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
|
||||||
if (fastBreakViolation.get(name) > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME) {
|
int i = fastBreakViolation.get(name);
|
||||||
|
if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME) {
|
||||||
lastBlockBroken.put(name, System.currentTimeMillis());
|
lastBlockBroken.put(name, System.currentTimeMillis());
|
||||||
if (!micromanage.getConfiguration().silentMode()) {
|
if (!micromanage.getConfiguration().silentMode()) {
|
||||||
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
|
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
|
||||||
}
|
}
|
||||||
return new CheckResult(Result.FAILED, player.getName()+" broke blocks too fast "+fastBreakViolation.get(name)+" times in a row (max="+violations+")");
|
return new CheckResult(Result.FAILED, player.getName()+" broke blocks too fast "+i+" times in a row (max="+violations+")");
|
||||||
} else if (fastBreakViolation.get(name) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME) {
|
} else if (fastBreakViolation.get(name) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME) {
|
||||||
fastBreakViolation.put(name, 0);
|
fastBreakViolation.put(name, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user