diff --git a/src/main/java/world/bentobox/bentobox/database/objects/Island.java b/src/main/java/world/bentobox/bentobox/database/objects/Island.java index ed8a5fcb5..16a69383b 100644 --- a/src/main/java/world/bentobox/bentobox/database/objects/Island.java +++ b/src/main/java/world/bentobox/bentobox/database/objects/Island.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.entity.Player; +import org.bukkit.util.BoundingBox; import org.bukkit.util.Vector; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; @@ -499,6 +500,15 @@ public class Island implements DataObject { return inIslandSpace(blockCoordinates.x, blockCoordinates.z); } + /** + * Returns a {@link BoundingBox} of the full island space. + * @return a {@link BoundingBox} of the full island space. + * @since 1.5.2 + */ + public BoundingBox getBoundingBox() { + return new BoundingBox(getMinX(), 0.0D, getMinZ(), getMaxX(), world.getMaxHeight(), getMaxZ()); + } + /** * Returns a list of players that are physically inside the island's protection range and that are visitors. * @return list of visitors @@ -571,6 +581,15 @@ public class Island implements DataObject { return Util.sameWorld(world, target.getWorld()) && target.getBlockX() >= getMinProtectedX() && target.getBlockX() < (getMinProtectedX() + protectionRange * 2) && target.getBlockZ() >= getMinProtectedZ() && target.getBlockZ() < (getMinProtectedZ() + protectionRange * 2); } + /** + * Returns a {@link BoundingBox} of this island's protected area. + * @return a {@link BoundingBox} of this island's protected area. + * @since 1.5.2 + */ + public BoundingBox getProtectionBoundingBox() { + return new BoundingBox(getMinProtectedX(), 0.0D, getMinProtectedZ(), getMaxProtectedX(), world.getMaxHeight(), getMaxProtectedZ()); + } + /** * Removes a player from the team member map. Generally, you should * use {@link world.bentobox.bentobox.managers.IslandsManager#removePlayer(World, UUID)}