Remove fast animation check.

Due to the networking at play here, there's no sane way to assume that animation events/packets are going to come at a certain time apart. Through testing, there have been legitimate animations come 0ms apart, which makes this check impossible, at least in its current state.
This commit is contained in:
gravitylow committed 2013-10-27 14:54:29 -04:00
1 parent c6818c11f7
commit d49e44b0ba
6 files changed
+1 -42

No files matched your search

@@ -39,14 +39,6 @@ import net.gravitydevelopment.anticheat.config.ConfigurationFile;
*/
public class Magic extends ConfigurationFile {
/**
* The number of animations to wait before checking fastclicking; Type=integer; +Leniency=Increase.
*/
public int ANIMATION_CHECK;
/**
* The minimum time it should have taken for the player to click X times; Type=integer; +Leniency=Increase.
*/
public long ANIMATION_TIMEMIN;
/**
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=system, +Leniency=Increase.
*/
@@ -467,8 +459,6 @@ public class Magic extends ConfigurationFile {
TIMER_STEP_CHECK = new ConfigValue<Integer>("TIMER_STEP_CHECK").getValue();
TIMER_TIMEMIN = new ConfigValue<Integer>("TIMER_TIMEMIN").getValue();
TELEPORT_MIN = new ConfigValue<Integer>("TELEPORT_MIN").getValue();
ANIMATION_CHECK = new ConfigValue<Integer>("ANIMATION_CHECK").getValue();
ANIMATION_TIMEMIN = new ConfigValue<Integer>("ANIMATION_TIMEMIN").getValue();
}
public double getVersion() {
@@ -246,14 +246,7 @@ public class PlayerListener extends EventListener {
@EventHandler
public void onPlayerAnimation(PlayerAnimationEvent event) {
Player player = event.getPlayer();
if (getCheckManager().willCheck(player, CheckType.FAST_ANIMATION)) {
CheckResult result = getBackend().checkFastAnimation(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_ANIMATION);
}
}
getBackend().logAnimation(event.getPlayer());
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@@ -86,8 +86,6 @@ public class Backend {
private Map<String, Long> stepTime = new HashMap<String, Long>();
private HashSet<Byte> transparent = new HashSet<Byte>();
private Map<String, Long> lastFallPacket = new HashMap<String, Long>();
private Map<String, Long> animationTime = new HashMap<String, Long>();
private Map<String, Integer> animations = new HashMap<String, Integer>();
private Magic magic;
private AnticheatManager manager = null;
@@ -871,24 +869,6 @@ public class Backend {
return PASS;
}
public CheckResult checkFastAnimation(final Player player) {
logAnimation(player);
String name = player.getName();
int clicks = animations.containsKey(name) ? animations.get(name) + 1 : 1;
animations.put(name, clicks);
if (clicks == 1) {
animationTime.put(name, System.currentTimeMillis());
} else if (clicks == magic.ANIMATION_CHECK) {
long time = System.currentTimeMillis() - animationTime.get(name);
animations.put(name, 0);
if (time < magic.ANIMATION_TIMEMIN) {
return new CheckResult(Result.FAILED, player.getName() + " clicked " + clicks + " times in " + time + " ms (max=" + magic.ANIMATION_CHECK + " in " + magic.ANIMATION_TIMEMIN + " ms)");
}
}
return PASS;
}
public void logAnimation(final Player player) {
animated.put(player.getName(), System.currentTimeMillis());
increment(player, blockPunches, magic.BLOCK_PUNCH_MIN);
@@ -57,7 +57,6 @@ public enum CheckType {
FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE),
ITEM_SPAM(Permission.CHECK_ITEMSPAM),
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
FAST_ANIMATION(Permission.CHECK_FASTANIMATION),
AUTOTOOL(Permission.CHECK_AUTOTOOL);
private final Permission permission;
@@ -48,7 +48,6 @@ public enum Permission {
CHECK_ITEMSPAM,
CHECK_VISUAL,
CHECK_FASTINVENTORY,
CHECK_FASTANIMATION,
CHECK_AUTOTOOL,
/* System Nodes */