Further fix to Location.

This commit is contained in:
Tahg 2012-01-10 00:20:03 -05:00
parent af8b5d0b9b
commit db392bc0f2

View File

@ -373,8 +373,10 @@ public class Location implements Cloneable {
*/ */
public double distanceSquared(Location o) { public double distanceSquared(Location o) {
if (o == null) { if (o == null) {
throw new IllegalArgumentException("Cannot measure distance to a null location");
} else if (o.getWorld() == null || getWorld() == null) {
throw new IllegalArgumentException("Cannot measure distance to a null world"); throw new IllegalArgumentException("Cannot measure distance to a null world");
} else if (o == null || o.getWorld() != getWorld()) { } else if (o.getWorld() != getWorld()) {
throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName()); throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName());
} }