Added Island#getBoundingBox() and Island#getProtectionBoundingBox()

https://github.com/BentoBoxWorld/BentoBox/issues/758
This commit is contained in:
Florian CUNY 2019-06-13 10:00:12 +02:00
parent 0cdd774d0b
commit 2e84860aa0

View File

@ -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)}