From 1b9b83efc868cd99b2e4876fa5c19018d6a08824 Mon Sep 17 00:00:00 2001 From: asofold Date: Sat, 8 Sep 2012 21:33:37 +0200 Subject: [PATCH] Tweak nofall slightly (performance). --- src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java b/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java index 07c70705..76cc76cd 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/NoFall.java @@ -4,6 +4,7 @@ import java.util.Locale; import net.minecraft.server.EntityPlayer; +import org.bukkit.Location; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; @@ -49,8 +50,11 @@ public class NoFall extends Check { final MovingData data = MovingData.getData(player); if (from.getY() > to.getY()){ - if (from.getyOnGround() != cc.noFallyOnGround) from.setyOnGround(cc.noFallyOnGround); - if (to.getyOnGround() != cc.noFallyOnGround) to.setyOnGround(cc.noFallyOnGround); + // Reset the on ground properties only if necessary. + if (from.getyOnGround() != cc.noFallyOnGround && (from.getY() - (double) Location.locToBlock(from.getY()) < cc.noFallyOnGround)) + from.setyOnGround(cc.noFallyOnGround); + if (to.getyOnGround() != cc.noFallyOnGround && (to.getY() - (double) Location.locToBlock(to.getY()) < cc.noFallyOnGround)) + to.setyOnGround(cc.noFallyOnGround); } data.noFallWasOnGround = data.noFallOnGround;