Package com.ranull.graves.manager
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 TypeMethodDescriptionbooleancanBuild(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, List<String> permissionList) Checks whether a living entity can build at the specified location, honoring Graves config, protection plugins and ProtectionLib (if present).org.bukkit.LocationDeprecated.org.bukkit.LocationgetLastSolidLocation(org.bukkit.entity.Entity entity) Gets the last solid location of an entity if still valid.org.bukkit.LocationgetLavaTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Deprecated.UseresolveLavaLocation(Location, LivingEntity, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave).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) Returns a new location if a cached grave already exists at the provided location.org.bukkit.LocationDeprecated.UseresolveRoofLocation(Location, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave).org.bukkit.LocationgetSafeGraveLocation(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Resolves a safe location to place a grave 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.org.bukkit.LocationDeprecated.UsegetSafeTeleportLocation(Entity, Location, Grave, Graves)or the new internal scanning helpers instead.org.bukkit.LocationDeprecated.UseresolveVoidLocation(Location, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave).booleanhasCachedGraveAt(org.bukkit.Location location) Checks whether there is a cached grave (fromCacheManager.getGraveMap()) at the given location, using rounded block coordinates for comparison.booleanhasGrave(org.bukkit.Location location) Checks whether a grave already exists at the given location.booleanisInsideBorder(org.bukkit.Location location) Determines whether a location is inside the world border (or always true for older versions without borders).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 minHeight or above maxHeight).voidremoveLastSolidLocation(org.bukkit.entity.Entity entity) Removes the last solid location for an entity from the cache map.voidsetLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location) Stores the last solid location for an entity in the cache map.
-
Constructor Details
-
LocationManager
-
-
Method Details
-
setLastSolidLocation
public void setLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location) Stores the last solid location for an entity in the cache map.- Parameters:
entity- entity to tracklocation- last known solid location
-
getLastSolidLocation
public org.bukkit.Location getLastSolidLocation(org.bukkit.entity.Entity entity) Gets the last solid location of an entity if still valid.- Parameters:
entity- entity whose last solid location is requested- Returns:
- valid last solid location, or
nullif none
-
removeLastSolidLocation
public void removeLastSolidLocation(org.bukkit.entity.Entity entity) Removes the last solid location for an entity from the cache map.- Parameters:
entity- entity whose cached 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 locationgrave- associated grave (for config scoping)plugin- plugin instance (unused, kept for API compatibility)- Returns:
- safe teleport location, or
nullif none found
-
getSafeGraveLocation
public org.bukkit.Location getSafeGraveLocation(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Resolves a safe location to place a grave for a dead entity.- Parameters:
livingEntity- dead entity (player or mob)location- original death locationgrave- grave being created- Returns:
- resolved grave location, or
nullif void handling also fails
-
canBuild
public boolean canBuild(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, List<String> permissionList) Checks whether a living entity can build at the specified location, honoring Graves config, protection plugins and ProtectionLib (if present).- Parameters:
livingEntity- entity attempting to buildlocation- target locationpermissionList- optional extra permissions- Returns:
trueif building is allowed, otherwisefalse
-
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 safe,falseotherwise
-
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 safe,falseotherwise
-
hasGrave
public boolean hasGrave(org.bukkit.Location location) Checks whether a grave already exists at the given location.- Parameters:
location- location to test- Returns:
trueif a grave is present,falseotherwise
-
isInsideBorder
public boolean isInsideBorder(org.bukkit.Location location) Determines whether a location is inside the world border (or always true for older versions without borders).- Parameters:
location- location to test- Returns:
trueif inside border or border is ignored,falseotherwise
-
isVoid
public boolean isVoid(org.bukkit.Location location) Determines whether a location is considered void (below minHeight or above maxHeight).- Parameters:
location- location to test- Returns:
trueif void,falseotherwise
-
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 0 if world/minHeight is unavailable
-
getNewLocationIfCachedGraveExists
public org.bukkit.Location getNewLocationIfCachedGraveExists(org.bukkit.entity.LivingEntity livingEntity, org.bukkit.Location location, Grave grave) Returns a new location if a cached grave already exists at the provided location.- Parameters:
livingEntity- the entity that owns the grave (not currently used, but kept for API parity)location- the desired grave locationgrave- the grave being placed (not currently used, but kept for API parity)- Returns:
- a new safe location if the original is occupied in the cache; otherwise the original
rounded location, or
nullif no alternative could be found
-
hasCachedGraveAt
public boolean hasCachedGraveAt(org.bukkit.Location location) Checks whether there is a cached grave (fromCacheManager.getGraveMap()) at the given location, using rounded block coordinates for comparison.- Parameters:
location- location to test- Returns:
trueif a cached grave is at that exact block position,falseotherwise
-
getTop
@Deprecated public org.bukkit.Location getTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Deprecated.UsegetSafeTeleportLocation(Entity, Location, Grave, Graves)or the new internal scanning helpers instead. This method is retained only for backward compatibility and is not used internally. -
getRoof
@Deprecated public org.bukkit.Location getRoof(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Deprecated.UseresolveRoofLocation(Location, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave). This method is retained only for backward compatibility and is not used internally. -
getGround
@Deprecated public org.bukkit.Location getGround(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Deprecated.UseresolveGroundLocation(Location, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave). This method is retained only for backward compatibility and is not used internally. -
getVoid
@Deprecated public org.bukkit.Location getVoid(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Deprecated.UseresolveVoidLocation(Location, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave). This method is retained only for backward compatibility and is not used internally. -
getLavaTop
@Deprecated public org.bukkit.Location getLavaTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave) Deprecated.UseresolveLavaLocation(Location, LivingEntity, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave). This method is retained only for backward compatibility and is not used internally.
-
resolveGroundLocation(Location, Grave)viagetSafeGraveLocation(LivingEntity, Location, Grave).