Class LocationManager

java.lang.Object
com.ranull.graves.manager.LocationManager

public final class LocationManager extends Object
Manages location-related operations for graves and safe teleportation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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).
    org.bukkit.Location
    getGround(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave)
    Deprecated.
    Use resolveGroundLocation(Location, Grave) via getSafeGraveLocation(LivingEntity, Location, Grave).
    org.bukkit.Location
    getLastSolidLocation(org.bukkit.entity.Entity entity)
    Gets the last solid location of an entity if still valid.
    org.bukkit.Location
    getLavaTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave)
    Deprecated.
    Use resolveLavaLocation(Location, LivingEntity, Grave) via getSafeGraveLocation(LivingEntity, Location, Grave).
    int
    getMinHeight(org.bukkit.Location location)
    Returns the minimum build height for the given location's world.
    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.
    org.bukkit.Location
    getRoof(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave)
    Deprecated.
    Use resolveRoofLocation(Location, Grave) via getSafeGraveLocation(LivingEntity, Location, Grave).
    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.
    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.
    org.bukkit.Location
    getTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave)
    Deprecated.
    Use getSafeTeleportLocation(Entity, Location, Grave, Graves) or the new internal scanning helpers instead.
    org.bukkit.Location
    getVoid(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave)
    Deprecated.
    Use resolveVoidLocation(Location, Grave) via getSafeGraveLocation(LivingEntity, Location, Grave).
    boolean
    hasCachedGraveAt(org.bukkit.Location location)
    Checks whether there is a cached grave (from CacheManager.getGraveMap()) at the given location, using rounded block coordinates for comparison.
    boolean
    hasGrave(org.bukkit.Location location)
    Checks whether a grave already exists at the given location.
    boolean
    isInsideBorder(org.bukkit.Location location)
    Determines whether a location is inside the world border (or always true for older versions without borders).
    boolean
    isLocationSafeGrave(org.bukkit.Location location)
    Determines whether a location is safe for placing a grave block.
    boolean
    isLocationSafePlayer(org.bukkit.Location location)
    Determines whether a location is safe for a player to stand/teleport at.
    boolean
    isVoid(org.bukkit.Location location)
    Determines whether a location is considered void (below minHeight or above maxHeight).
    void
    removeLastSolidLocation(org.bukkit.entity.Entity entity)
    Removes the last solid location for an entity from the cache map.
    void
    setLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location)
    Stores the last solid location for an entity in the cache map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LocationManager

      public LocationManager(Graves plugin)
  • 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 track
      location - 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 null if 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 teleported
      location - requested teleport location
      grave - associated grave (for config scoping)
      plugin - plugin instance (unused, kept for API compatibility)
      Returns:
      safe teleport location, or null if 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 location
      grave - grave being created
      Returns:
      resolved grave location, or null if 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 build
      location - target location
      permissionList - optional extra permissions
      Returns:
      true if building is allowed, otherwise false
    • 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:
      true if safe, false otherwise
    • 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:
      true if safe, false otherwise
    • hasGrave

      public boolean hasGrave(org.bukkit.Location location)
      Checks whether a grave already exists at the given location.
      Parameters:
      location - location to test
      Returns:
      true if a grave is present, false otherwise
    • 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:
      true if inside border or border is ignored, false otherwise
    • 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:
      true if void, false otherwise
    • 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 location
      grave - 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 null if no alternative could be found
    • hasCachedGraveAt

      public boolean hasCachedGraveAt(org.bukkit.Location location)
      Checks whether there is a cached grave (from CacheManager.getGraveMap()) at the given location, using rounded block coordinates for comparison.
      Parameters:
      location - location to test
      Returns:
      true if a cached grave is at that exact block position, false otherwise
    • getTop

      @Deprecated public org.bukkit.Location getTop(org.bukkit.Location location, org.bukkit.entity.Entity entity, Grave grave)
      Deprecated.
      Use getSafeTeleportLocation(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.
      Use resolveRoofLocation(Location, Grave) via getSafeGraveLocation(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.
      Use resolveGroundLocation(Location, Grave) via getSafeGraveLocation(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.
      Use resolveVoidLocation(Location, Grave) via getSafeGraveLocation(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.
      Use resolveLavaLocation(Location, LivingEntity, Grave) via getSafeGraveLocation(LivingEntity, Location, Grave). This method is retained only for backward compatibility and is not used internally.