Package com.ranull.graves.manager
Class LocationManager
java.lang.Object
com.ranull.graves.manager.LocationManager
Manages location-related operations for graves.
-
Constructor Summary
ConstructorsConstructorDescriptionLocationManager(Graves plugin) Initializes a new instance of the LocationManager class. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBuild(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, List<String> permissionList) Determines if a living entity can build at a specified location.org.bukkit.LocationGets the ground location for placement.org.bukkit.LocationgetLastSolidLocation(org.bukkit.entity.Entity entity) Gets the last solid location of an entity.org.bukkit.LocationgetLavaTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the top location above lava for placement.intgetMinHeight(org.bukkit.Location location) Gets the minimum height for a location.org.bukkit.LocationGets the roof location for placement.org.bukkit.LocationgetSafeGraveLocation(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Gets a safe grave location.org.bukkit.LocationgetSafeTeleportLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave, Graves plugin) Gets a safe teleport location.org.bukkit.LocationFinds the top location for placement, searching downward from the given location's Y-coordinate.org.bukkit.LocationGets the void location for placement.org.bukkit.LocationgetWaterTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the top location above water for placement.booleanhasGrave(org.bukkit.Location location) Determines if a location has a grave.booleanisInsideBorder(org.bukkit.Location location) Determines if a location is inside the world border.booleanisLocationSafeGrave(org.bukkit.Location location) Determines if a location is safe for a grave.booleanisLocationSafePlayer(org.bukkit.Location location) Determines if a location is safe for a player to spawn or teleport to.booleanisVoid(org.bukkit.Location location) Determines if the specified location is in the void.voidremoveLastSolidLocation(org.bukkit.entity.Entity entity) Removes the last solid location of an entity.voidsetLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location) Sets the last solid location of an entity.
-
Constructor Details
-
LocationManager
Initializes a new instance of the LocationManager class.- Parameters:
plugin- The plugin instance.
-
-
Method Details
-
setLastSolidLocation
public void setLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location) Sets the last solid location of an entity.- Parameters:
entity- The entity.location- The location.
-
getLastSolidLocation
public org.bukkit.Location getLastSolidLocation(org.bukkit.entity.Entity entity) Gets the last solid location of an entity.- Parameters:
entity- The entity.- Returns:
- The last solid location.
-
removeLastSolidLocation
public void removeLastSolidLocation(org.bukkit.entity.Entity entity) Removes the last solid location of an entity.- Parameters:
entity- The entity.
-
getSafeTeleportLocation
public org.bukkit.Location getSafeTeleportLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave, Graves plugin) Gets a safe teleport location.- Parameters:
entity- The entity.location- The location.grave- The grave.plugin- The plugin instance.- Returns:
- The safe teleport location.
-
getSafeGraveLocation
public org.bukkit.Location getSafeGraveLocation(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Gets a safe grave location.- Parameters:
livingEntity- The living entity.location- The location.grave- The grave.- Returns:
- The safe grave location.
-
getTop
public org.bukkit.Location getTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Finds the top location for placement, searching downward from the given location's Y-coordinate.- Parameters:
location- The base location.entity- The entity.grave- The grave.- Returns:
- The found top location, or null if no suitable location is found.
-
getRoof
public org.bukkit.Location getRoof(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the roof location for placement.- Parameters:
location- The location.entity- The entity.grave- The grave.- Returns:
- The roof location.
-
getGround
public org.bukkit.Location getGround(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the ground location for placement.- Parameters:
location- The location.entity- The entity.grave- The grave.- Returns:
- The ground location.
-
getVoid
public org.bukkit.Location getVoid(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the void location for placement.- Parameters:
location- The location.entity- The entity.grave- The grave.- Returns:
- The void location.
-
getLavaTop
public org.bukkit.Location getLavaTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the top location above lava for placement.- Parameters:
location- The location to check.entity- The entity.grave- The grave.- Returns:
- The lava top location, or null if no valid location is found.
-
getWaterTop
public org.bukkit.Location getWaterTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Gets the top location above water for placement.- Parameters:
location- The location to check.entity- The entity.grave- The grave.- Returns:
- The water top location, or null if no valid location is found.
-
canBuild
public boolean canBuild(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, List<String> permissionList) Determines if a living entity can build at a specified location.- Parameters:
livingEntity- The living entity.location- The location.permissionList- The list of permissions.- Returns:
- True if the entity can build, otherwise false.
-
isLocationSafePlayer
public boolean isLocationSafePlayer(org.bukkit.Location location) Determines if a location is safe for a player to spawn or teleport to. A location is considered safe if: - It is inside the world border. - The current block and block above are not solid or lava. - The block below is solid and not lava.- Parameters:
location- The location to check.- Returns:
- True if the location is safe; otherwise, false.
-
isLocationSafeGrave
public boolean isLocationSafeGrave(org.bukkit.Location location) Determines if a location is safe for a grave.- Parameters:
location- The location.- Returns:
- True if the location is safe, otherwise false.
-
hasGrave
public boolean hasGrave(org.bukkit.Location location) Determines if a location has a grave.- Parameters:
location- The location.- Returns:
- True if the location has a grave, otherwise false.
-
isInsideBorder
public boolean isInsideBorder(org.bukkit.Location location) Determines if a location is inside the world border. For versions prior to 1.12, the world border is ignored and this always returns true.- Parameters:
location- The location to check.- Returns:
- True if the location is inside the world border; otherwise, false.
-
isVoid
public boolean isVoid(org.bukkit.Location location) Determines if the specified location is in the void. A location is considered in the void if it's below the world's minimum height or above its maximum build height.- Parameters:
location- The location to check.- Returns:
- True if the location is in the void; otherwise, false.
-
getMinHeight
public int getMinHeight(org.bukkit.Location location) Gets the minimum height for a location.- Parameters:
location- The location.- Returns:
- The minimum height.
-