From 68acc4139891fd9f4595ae6cfa097974e0903654 Mon Sep 17 00:00:00 2001 From: Super Spy Date: Wed, 13 Jun 2012 07:05:11 -0500 Subject: [PATCH] Reimplemented delay for Visuals check. The correct way. Fix issues #66 and #65 --- .../net/h31ix/anticheat/event/PlayerListener.java | 4 ++++ .../java/net/h31ix/anticheat/manage/Backend.java | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java index ebe4f40..f008cbb 100644 --- a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java +++ b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java @@ -189,6 +189,10 @@ public class PlayerListener extends EventListener event.setCancelled(true); log("tried to interact with an object that they couldn't see", player, CheckType.VISUAL); //boring description though. } + else + { + backend.logInteraction(player); + } } } } diff --git a/src/main/java/net/h31ix/anticheat/manage/Backend.java b/src/main/java/net/h31ix/anticheat/manage/Backend.java index da0352d..9705565 100644 --- a/src/main/java/net/h31ix/anticheat/manage/Backend.java +++ b/src/main/java/net/h31ix/anticheat/manage/Backend.java @@ -60,6 +60,7 @@ public class Backend private static final int FASTPLACE_MAXVIOLATIONTIME = 10000; private static final double VISUALS_MAXOFFSET = 2; + private static final long VISUALS_DELAY = 20L; private static final int BLOCK_PUNCH_MIN = 5; @@ -128,6 +129,7 @@ public class Backend private List isAscending = new ArrayList(); private List trackingProjectiles = new ArrayList(); private List velocitizing = new ArrayList(); + private List interacting = new ArrayList(); private Map ascensionCount = new HashMap(); private Map oldMessage = new HashMap(); private Map lastMessage = new HashMap(); @@ -276,6 +278,9 @@ public class Backend public boolean checkInteraction(Player player, Block targetBlock, Block playerClick) { + if (isInteracting(player) && !Utilities.isInteractable(targetBlock.getType())) + return false; + int strikes = 0; double x = targetBlock.getX() - playerClick.getX() * ((targetBlock.getX() - playerClick.getX() * 1) < 0 ? -1 : 1); @@ -700,6 +705,16 @@ public class Backend logEvent(healed, player, HEAL_MIN); } + public void logInteraction(Player player) + { + logEvent(interacting, player, VISUALS_DELAY); + } + + public boolean isInteracting(Player player) + { + return interacting.contains(player.getName()); + } + public boolean justHealed(Player player) { return healed.contains(player.getName());