From e388d4471904cfb7a8867ac3dda62668612f5729 Mon Sep 17 00:00:00 2001 From: Evenprime Date: Fri, 11 Mar 2011 07:57:23 +0100 Subject: [PATCH] Fixed some minor loopholes that would allow players to fly/speedhack after getting legitimately teleported somewhere. They would've still been logged, but the "reset" functionality could be broken in these cases. --- plugin.yml | 2 +- .../evenprime/bukkit/nocheat/checks/MovingCheck.java | 12 +++++++++--- .../bukkit/nocheat/checks/SpeedhackCheck.java | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/plugin.yml b/plugin.yml index 65f0fa15..93c70826 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ name: NoCheatPlugin author: Evenprime main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin -version: 0.6.6 +version: 0.6.6a commands: nocheat: diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java index 25b418d9..814c4f5a 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java @@ -274,6 +274,11 @@ public class MovingCheck { data.movingLegitMovesInARow = 0; + // If we haven't already got a setback point, make this location the new setback point + if(data.movingSetBackPoint == null) { + data.movingSetBackPoint = event.getFrom().clone(); + } + String actions = null; boolean log = true; @@ -381,9 +386,10 @@ public class MovingCheck { NoCheatData data = NoCheatPlugin.getPlayerData(event.getPlayer()); - // Still not a perfect solution. After resetting a player his vertical momentum gets lost - // Therefore we can't expect him to fall big distances in his next move, therefore we have to - // set his flying phase to something he can work with. + // Reset the jumpphase. We choose the setback-point such that it should be + // on solid ground, but in case it isn't (maybe the ground is gone now) we + // still have to allow the player some freedom with vertical movement due + // to lost vertical momentum to prevent him from getting stuck data.movingJumpPhase = 0; // If we have stored a location for the player, we put him back there diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java index 0b0fbeec..f73ddf9e 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java @@ -50,6 +50,10 @@ public class SpeedhackCheck { data.speedhackViolationsInARow = 0; } else { + // If we haven't already got a setback point, create one now + if(data.speedhackSetBackPoint == null) { + data.speedhackSetBackPoint = event.getFrom().clone(); + } data.speedhackViolationsInARow++; }