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
    org.bukkit.Location
    getLastSolidLocation(org.bukkit.entity.Entity entity)
    Returns the entity's last known solid location, if still valid.
    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)
    If a cached grave already exists at the provided location, finds a nearby alternative location.
    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.
    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.
    boolean
    hasCachedGraveAt(org.bukkit.Location location)
    Checks whether a cached grave (from CacheManager#getGraveMap()) exists at the given block coordinates.
    boolean
    hasGrave(org.bukkit.Location location)
    Checks whether a persisted grave exists at the given location.
    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).
    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 min height or above max height).
    void
    removeLastSolidLocation(org.bukkit.entity.Entity entity)
    Removes any stored last-solid location for the given entity.
    void
    setLastSolidLocation(org.bukkit.entity.Entity entity, org.bukkit.Location location)
    Stores the last known "solid ground" location for an entity.

    Methods inherited from class 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 known "solid ground" location for an entity.
      Parameters:
      entity - entity to track
      location - 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 null if 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 teleported
      location - requested teleport destination
      grave - associated grave (for config scoping)
      plugin - plugin instance (kept for API compatibility; forwarded to the delegate)
      Returns:
      a safe teleport location, or null if 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 location
      grave - grave being created
      Returns:
      resolved grave location, or null if 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:
      true if the location is safe for a player, otherwise false
    • 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 the location is safe for a grave, otherwise false
    • hasGrave

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

      public boolean hasCachedGraveAt(org.bukkit.Location location)
      Checks whether a cached grave (from CacheManager#getGraveMap()) exists at the given block coordinates.
      Parameters:
      location - location to test
      Returns:
      true if a cached grave exists at that exact block position, otherwise false