summaryrefslogtreecommitdiffstats
path: root/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java')
-rw-r--r--EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java
new file mode 100644
index 000000000..5cf828c96
--- /dev/null
+++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java
@@ -0,0 +1,51 @@
+package com.earth2me.essentials.anticheat.data;
+
+import org.bukkit.Location;
+
+
+/**
+ * A class to store x,y,z triple data, instead of using bukkits Location objects, which can't be easily recycled
+ *
+ */
+public final class PreciseLocation
+{
+ public double x;
+ public double y;
+ public double z;
+
+ public PreciseLocation()
+ {
+ reset();
+ }
+
+ public final void set(Location location)
+ {
+ x = location.getX();
+ y = location.getY();
+ z = location.getZ();
+ }
+
+ public final void set(PreciseLocation location)
+ {
+ x = location.x;
+ y = location.y;
+ z = location.z;
+ }
+
+ public final boolean isSet()
+ {
+ return x != Double.MAX_VALUE;
+ }
+
+ public final void reset()
+ {
+ x = Double.MAX_VALUE;
+ y = Double.MAX_VALUE;
+ z = Double.MAX_VALUE;
+ }
+
+ public final boolean equals(Location location)
+ {
+ return location.getX() == x && location.getY() == y && location.getZ() == z;
+ }
+}