Class LocationManager
java.lang.Object
com.ranull.graves.manager.LocationManager
Manages location-related operations for graves and safe teleportation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationgetLastSolidLocation(org.bukkit.entity.Entity entity) Returns the entity's last known solid location, if still valid.intgetMinHeight(org.bukkit.Location location) Returns the minimum build height for the given location's world.org.bukkit.LocationgetNewLocationIfCachedGraveExists(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) If a cached grave already exists at the provided location, finds a nearby alternative location.org.bukkit.LocationgetSafeGraveLocation(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Resolves a safe location for grave placement for a dead entity.org.bukkit.LocationgetSafeTeleportLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave, Graves plugin) Resolves a safe teleport location for an entity.booleanhasCachedGraveAt(org.bukkit.Location location) Checks whether a cached grave (fromCacheManager#getGraveMap()) exists at the given block coordinates.booleanhasGrave(org.bukkit.Location location) Checks whether a persisted grave exists at the given location.booleanisInsideBorder(org.bukkit.Location location) Determines whether a location is inside the world border (or always true on older versions where borders may not exist).booleanisLocationSafeGrave(org.bukkit.Location location) Determines whether a location is safe for placing a grave block.booleanisLocationSafePlayer(org.bukkit.Location location) Determines whether a location is safe for a player to stand/teleport at.booleanisVoid(org.bukkit.Location location) Determines whether a location is considered void (below min height or above max height).voidremoveLastSolidLocation(org.bukkit.entity.Entity entity) Removes any stored last-solid location for the given entity.voidsetLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location) Stores the last known "solid ground" location for an entity.
-
Constructor Details
-
LocationManager
-
-
Method Details
-
setLastSolidLocation
public void setLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location) Stores the last known "solid ground" location for an entity.- Parameters:
entity- entity to tracklocation- last known solid location to store
-
getLastSolidLocation
public org.bukkit.Location getLastSolidLocation(org.bukkit.entity.Entity entity) Returns the entity's last known solid location, if still valid.- Parameters:
entity- entity whose last solid location is requested- Returns:
- the last solid location, or
nullif none is stored, or it is no longer valid
-
removeLastSolidLocation
public void removeLastSolidLocation(org.bukkit.entity.Entity entity) Removes any stored last-solid location for the given entity.- Parameters:
entity- entity whose cached last-solid location should be removed
-
getSafeTeleportLocation
public org.bukkit.Location getSafeTeleportLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave, Graves plugin) Resolves a safe teleport location for an entity.- Parameters:
entity- entity being teleportedlocation- requested teleport destinationgrave- associated grave (for config scoping)plugin- plugin instance (kept for API compatibility; forwarded to the delegate)- Returns:
- a safe teleport location, or
nullif none could be resolved
-
getSafeGraveLocation
public org.bukkit.Location getSafeGraveLocation(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Resolves a safe location for grave placement for a dead entity.- Parameters:
livingEntity- dead entity (player or mob)location- original death locationgrave- grave being created- Returns:
- resolved grave location, or
nullif none could be resolved
-
isLocationSafePlayer
public boolean isLocationSafePlayer(org.bukkit.Location location) Determines whether a location is safe for a player to stand/teleport at.- Parameters:
location- location to test- Returns:
trueif the location is safe for a player, otherwisefalse
-
isLocationSafeGrave
public boolean isLocationSafeGrave(org.bukkit.Location location) Determines whether a location is safe for placing a grave block.- Parameters:
location- location to test- Returns:
trueif the location is safe for a grave, otherwisefalse
-
hasGrave
public boolean hasGrave(org.bukkit.Location location) Checks whether a persisted grave exists at the given location.- Parameters:
location- location to test- Returns:
trueif a grave is present, otherwisefalse
-
isInsideBorder
public boolean isInsideBorder(org.bukkit.Location location) Determines whether a location is inside the world border (or always true on older versions where borders may not exist).- Parameters:
location- location to test- Returns:
trueif the location is inside the border (or border checks are ignored), otherwisefalse
-
isVoid
public boolean isVoid(org.bukkit.Location location) Determines whether a location is considered void (below min height or above max height).- Parameters:
location- location to test- Returns:
trueif void, otherwisefalse
-
getMinHeight
public int getMinHeight(org.bukkit.Location location) Returns the minimum build height for the given location's world.- Parameters:
location- location whose world is inspected- Returns:
- minimum height, or
0if unavailable
-
getNewLocationIfCachedGraveExists
public org.bukkit.Location getNewLocationIfCachedGraveExists(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) If a cached grave already exists at the provided location, finds a nearby alternative location.- Parameters:
livingEntity- the entity that owns the grave (not used; retained for API parity)location- desired grave locationgrave- the grave being placed (not used; retained for API parity)- Returns:
- a new safe location if the original is occupied by a cached grave; otherwise the original rounded location;
or
nullif no suitable alternative could be found
-
hasCachedGraveAt
public boolean hasCachedGraveAt(org.bukkit.Location location) Checks whether a cached grave (fromCacheManager#getGraveMap()) exists at the given block coordinates.- Parameters:
location- location to test- Returns:
trueif a cached grave exists at that exact block position, otherwisefalse
-