Skip to content

Commit

Permalink
ellipsoidtag: don't error from null world
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 23, 2020
1 parent 06732f6 commit a4c1f8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Expand Up @@ -312,10 +312,10 @@ public boolean equals(Object other) {
if (!center.getWorldName().equals(ellipsoid2.center.getWorldName())) {
return false;
}
if (center.distanceSquared(ellipsoid2.center) >= 0.25) {
if (center.distanceSquaredNoWorld(ellipsoid2.center) >= 0.25) {
return false;
}
if (size.distanceSquared(ellipsoid2.size) >= 0.25) {
if (size.distanceSquaredNoWorld(ellipsoid2.size) >= 0.25) {
return false;
}
return true;
Expand Down
Expand Up @@ -44,6 +44,7 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.BlockIterator;
import org.bukkit.util.NumberConversions;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;

Expand Down Expand Up @@ -605,6 +606,10 @@ public LocationTag multiply(double input) {
return this;
}

public double distanceSquaredNoWorld(Location loc2) {
return NumberConversions.square(getX() - loc2.getX()) + NumberConversions.square(getY() - loc2.getY()) + NumberConversions.square(getZ() - loc2.getZ());
}

public boolean hasInventory() {
return getBlockState() instanceof InventoryHolder;
}
Expand Down

0 comments on commit a4c1f8e

Please sign in to comment.