mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Added #66 and fixed issue with Velocity check
This commit is contained in:
1 parent
aa9fa9b290
commit
27bb684736
17 files changed
+106
-113
No files matched your search
@@ -510,16 +510,12 @@ public class Backend {
|
||||
fastPlaceViolation.put(uuid, 0);
|
||||
}
|
||||
} else if (fastPlaceViolation.containsKey(uuid) && fastPlaceViolation.get(uuid) > violations) {
|
||||
AntiCheatReloaded.debugLog("Noted that fastPlaceViolation contains key " + uuid + " with value "
|
||||
+ fastPlaceViolation.get(uuid));
|
||||
Long math = System.currentTimeMillis() - lastBlockPlaced.get(uuid);
|
||||
AntiCheatReloaded.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
|
||||
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
lastBlockPlaced.put(uuid, time);
|
||||
return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast "
|
||||
+ fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
|
||||
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
AntiCheatReloaded.debugLog("Reset facePlaceViolation for " + uuid);
|
||||
fastPlaceViolation.put(uuid, 0);
|
||||
}
|
||||
} else if (lastBlockPlaced.containsKey(uuid)) {
|
||||
|
||||
@@ -41,34 +41,34 @@ public class VelocityCheck {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
|
||||
public static void runCheck(EntityDamageByEntityEvent e, final Player p) {
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
|
||||
|| AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
||||
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
|
||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
|
||||
return;
|
||||
final Location then = p.getLocation();
|
||||
final Location then = player.getLocation();
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!p.isOnline())
|
||||
if (!player.isOnline())
|
||||
return;
|
||||
if (then.distance(p.getLocation()) < 0.125) {
|
||||
if (!VL_COUNT.containsKey(p.getUniqueId()))
|
||||
VL_COUNT.put(p.getUniqueId(), 1);
|
||||
if (then.distance(player.getLocation()) < 0.125) {
|
||||
if (!VL_COUNT.containsKey(player.getUniqueId()))
|
||||
VL_COUNT.put(player.getUniqueId(), 1);
|
||||
else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
VL_COUNT.put(player.getUniqueId(), VL_COUNT.get(player.getUniqueId()) + 1);
|
||||
if (VL_COUNT.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_MAX_FLAGS()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
"had zero/low velocity "
|
||||
+ VL_COUNT.get(p.getUniqueId()) + " times (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_MAX_FLAGS()
|
||||
+ ", dist=" + then.distance(p.getLocation()) + ")").getMessage(),
|
||||
p, CheckType.VELOCITY);
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED,
|
||||
"had zero/low velocity " + VL_COUNT.get(player.getUniqueId()) + " times (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_MAX_FLAGS()
|
||||
+ ", dist=" + then.distance(player.getLocation()) + ")").getMessage(),
|
||||
player, CheckType.VELOCITY);
|
||||
VL_COUNT.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
VL_COUNT.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||
|
||||
Reference in new issue
Block a user