Tweak nofall slightly (performance).

This commit is contained in:
asofold 2012-09-08 21:33:37 +02:00
parent cc7eb2cbce
commit 1b9b83efc8

View File

@ -4,6 +4,7 @@ import java.util.Locale;
import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityPlayer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -49,8 +50,11 @@ public class NoFall extends Check {
final MovingData data = MovingData.getData(player); final MovingData data = MovingData.getData(player);
if (from.getY() > to.getY()){ if (from.getY() > to.getY()){
if (from.getyOnGround() != cc.noFallyOnGround) from.setyOnGround(cc.noFallyOnGround); // Reset the on ground properties only if necessary.
if (to.getyOnGround() != cc.noFallyOnGround) to.setyOnGround(cc.noFallyOnGround); 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; data.noFallWasOnGround = data.noFallOnGround;