diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/location/tracking/LocationTrace.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/location/tracking/LocationTrace.java index 1d658a20..ba0fdf7c 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/location/tracking/LocationTrace.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/location/tracking/LocationTrace.java @@ -52,6 +52,16 @@ public class LocationTrace { public long getTime(); + /** + * Convenience method. + * + * @param x + * @param y + * @param z + * @return + */ + public boolean isInside(double x, double y, double z); + } public static class TraceEntry implements ITraceEntry { @@ -60,7 +70,10 @@ public class LocationTrace { /** We keep it open, if ticks or ms are used. */ private long time; - /** Coordinates. */ + /** + * Coordinates, box bottom center position with margins to the sides and + * to top. + */ private double x, y, z, boxMarginHorizontal, boxMarginVertical; /** Older/next. */ @@ -114,6 +127,13 @@ public class LocationTrace { return time; } + @Override + public boolean isInside(final double x, final double y, final double z) { + return y >= this.y && y <= this.y + this.boxMarginVertical + && Math.abs(x - this.x) <= this.boxMarginHorizontal + && Math.abs(z - this.z) <= this.boxMarginHorizontal; + } + } public static final class TraceEntryPool extends AbstractPool {