From 29f5a153a5717ab14761e178aadf169b481c0b66 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 15 Feb 2013 15:46:19 +0100 Subject: [PATCH] Fix isSameBlock(Location), add convenience methods isBlockAbove. --- .../nocheatplus/utilities/PlayerLocation.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java index 7044084d..bf33fcd5 100644 --- a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java +++ b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java @@ -218,7 +218,25 @@ public class PlayerLocation { * @return */ public final boolean isSameBlock(final Location loc) { - return x == loc.getBlockX() && z == loc.getBlockZ() && y == loc.getBlockY(); + return blockX == loc.getBlockX() && blockZ == loc.getBlockZ() && blockY == loc.getBlockY(); + } + + /** + * Check if this location is above the given one (blockY + 1). + * @param loc + * @return + */ + public boolean isBlockAbove(final PlayerLocation loc){ + return blockY == loc.getBlockY() + 1 && blockX == loc.getBlockX() && blockZ == loc.getBlockZ(); + } + + /** + * Check if this location is above the given one (blockY + 1). + * @param loc + * @return + */ + public boolean isBlockAbove(final Location loc){ + return blockY == loc.getBlockY() + 1 && blockX == loc.getBlockX() && blockZ == loc.getBlockZ(); } /**