summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2012-01-09 23:55:43 -0500
committerEvilSeph <evilseph@gmail.com>2012-01-09 23:55:43 -0500
commitaf8b5d0b9bd33bb6b345ab4e9d6956368ab09e6e (patch)
tree870cbdcc9d57cab534fdc78a62cd84decad1a5cc /src/main/java
parent774a3b134207c66141c1d8f3b4e5b3d6a55c319e (diff)
downloadbukkit-af8b5d0b9bd33bb6b345ab4e9d6956368ab09e6e.tar
bukkit-af8b5d0b9bd33bb6b345ab4e9d6956368ab09e6e.tar.gz
bukkit-af8b5d0b9bd33bb6b345ab4e9d6956368ab09e6e.tar.lz
bukkit-af8b5d0b9bd33bb6b345ab4e9d6956368ab09e6e.tar.xz
bukkit-af8b5d0b9bd33bb6b345ab4e9d6956368ab09e6e.zip
Revert "Improved some debug in Location."
This reverts commit 0569e71b26ffc88a5b752ce1217c3ba33e6586e9.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/Location.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index f4b8c989..4afabd88 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -360,11 +360,7 @@ public class Location implements Cloneable {
* @throws IllegalArgumentException for differing worlds
*/
public double distance(Location o) {
- if (o == null || o.getWorld() != getWorld()) {
- throw new IllegalArgumentException("Cannot measure distance between worlds or to null");
- }
-
- return Math.sqrt(Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2));
+ return Math.sqrt(distanceSquared(o));
}
/**
@@ -376,8 +372,10 @@ public class Location implements Cloneable {
* @throws IllegalArgumentException for differing worlds
*/
public double distanceSquared(Location o) {
- if (o == null || o.getWorld() != getWorld()) {
- throw new IllegalArgumentException("Cannot measure distance between worlds or to null");
+ if (o == null) {
+ throw new IllegalArgumentException("Cannot measure distance to a null world");
+ } else if (o == null || o.getWorld() != getWorld()) {
+ throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName());
}
return Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2);