From eb28f4775ce05b2deeb009c757cc8489eb7542f6 Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 27 Feb 2013 21:39:22 +0100 Subject: [PATCH] Fix issue with hover check on players joining. Re-check if survivalfly is checked at all for the player in case of exceeding hover-ticks. --- .../checks/moving/MovingListener.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 503543be..7eb4e929 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -1098,6 +1098,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo // Reset hover ticks until a better method is used. if (cc.sfHoverCheck){ // Start as if hovering already. + // Could check shouldCheckSurvivalFly(player, data, cc), but this should be more sharp (gets checked on violation). data.sfHoverTicks = 0; hoverTicks.add(player.getName()); } @@ -1233,10 +1234,18 @@ public class MovingListener extends CheckListener implements TickListener, IRemo } else{ if (data.sfHoverTicks > cc.sfHoverTicks){ - handleHoverViolation(player, loc, cc, data); - // Assume the player might still be hovering. - res = false; - data.sfHoverTicks = 0; + // Re-Check if survivalfly can apply at all. + if (shouldCheckSurvivalFly(player, data, cc)){ + handleHoverViolation(player, loc, cc, data); + // Assume the player might still be hovering. + res = false; + data.sfHoverTicks = 0; + } + else{ + // Reset hover ticks and check next period. + res = false; + data.sfHoverTicks = 0; + } } else res = false; }