From d5136dc78883fe447d313e61d0f7ddbdbec3891f Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 25 Nov 2012 23:24:06 +0100 Subject: [PATCH] Add convenience methods for block coordinate comparison. --- .../nocheatplus/utilities/PlayerLocation.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java b/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java index 7b324d8a..95722ef5 100644 --- a/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java +++ b/src/fr/neatmonster/nocheatplus/utilities/PlayerLocation.java @@ -188,6 +188,26 @@ public class PlayerLocation { public final boolean isSameBlock(final PlayerLocation other) { return blockX == other.getBlockX() && blockZ == other.getBlockZ() && blockY == other.getBlockY(); } + + /** + * Block coordinate comparison. + * @param x + * @param y + * @param z + * @return + */ + public final boolean isSameBlock(final int x, final int y, final int z) { + return blockX == x && blockZ == z && blockY == y; + } + + /** + * Compares block coordinates (not the world). + * @param loc + * @return + */ + public final boolean isSameBlock(final Location loc) { + return x == loc.getBlockX() && z == loc.getBlockZ() && y == loc.getBlockY(); + } /** * Compares exact coordinates (not the world).