summaryrefslogtreecommitdiffstats
path: root/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java
blob: 5cf828c964f74178c25a3152b340987613f24f99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
	}
}