Class LocationAPI

java.lang.Object
dev.cwhead.GravesX.api.world.LocationAPI

public final class LocationAPI extends Object
World/location helper API.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    chunkStringToLocation(@NotNull String string)
    Converts a chunk string representation back to a Location object.
    chunkToString(@NotNull org.bukkit.Location location)
    Converts a chunk's location to a string representation.
    org.bukkit.Location
    getClosestLocation(@NotNull org.bukkit.Location locationBase, @NotNull List<org.bukkit.Location> locationList)
    Finds the closest location to a given base location from a list of locations.
    org.bukkit.Rotation
    getRotationFromBlockFace(@NotNull org.bukkit.block.BlockFace face)
    Retrieves the Rotation corresponding to a given BlockFace.
    locationToString(@NotNull org.bukkit.Location location)
    Converts a Location object to a string representation.
    org.bukkit.Location
    roundLocation(@NotNull org.bukkit.Location location)
    Rounds the given location's coordinates to the nearest whole numbers.
    org.bukkit.block.BlockFace
    simplifyBlockFace(@NotNull org.bukkit.block.BlockFace face)
    Simplifies a given BlockFace to one of the four cardinal directions (NORTH, EAST, SOUTH, WEST).
    org.bukkit.Location
    stringToLocation(@NotNull String string)
    Converts a string representation of a location back to a Location object.

    Methods inherited from class java.lang.Object

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

    • LocationAPI

      public LocationAPI(Graves plugin)
  • Method Details

    • roundLocation

      public org.bukkit.Location roundLocation(@NotNull @NotNull org.bukkit.Location location)
      Rounds the given location's coordinates to the nearest whole numbers.
      Parameters:
      location - The location to be rounded.
      Returns:
      A new location with rounded coordinates.
    • locationToString

      public String locationToString(@NotNull @NotNull org.bukkit.Location location)
      Converts a Location object to a string representation.
      Parameters:
      location - The location to be converted.
      Returns:
      A string representation of the location in the format "world|x|y|z".
    • chunkToString

      public String chunkToString(@NotNull @NotNull org.bukkit.Location location)
      Converts a chunk's location to a string representation.
      Parameters:
      location - The location within the chunk.
      Returns:
      A string representation of the chunk in the format "world|chunkX|chunkZ".
    • chunkStringToLocation

      public org.bukkit.Location chunkStringToLocation(@NotNull @NotNull String string)
      Converts a chunk string representation back to a Location object.
      Parameters:
      string - The string representation of the chunk in the format "world|chunkX|chunkZ".
      Returns:
      A Location object representing the chunk.
    • stringToLocation

      public org.bukkit.Location stringToLocation(@NotNull @NotNull String string)
      Converts a string representation of a location back to a Location object.
      Parameters:
      string - The string representation of the location in the format "world|x|y|z".
      Returns:
      A Location object.
    • getClosestLocation

      public org.bukkit.Location getClosestLocation(@NotNull @NotNull org.bukkit.Location locationBase, @NotNull @NotNull List<org.bukkit.Location> locationList)
      Finds the closest location to a given base location from a list of locations.
      Parameters:
      locationBase - The base location to compare against.
      locationList - The list of locations to search through.
      Returns:
      The closest location to the base location, or null if the list is empty.
    • simplifyBlockFace

      public org.bukkit.block.BlockFace simplifyBlockFace(@NotNull @NotNull org.bukkit.block.BlockFace face)
      Simplifies a given BlockFace to one of the four cardinal directions (NORTH, EAST, SOUTH, WEST).
      Parameters:
      face - The BlockFace to simplify.
      Returns:
      The simplified BlockFace.
    • getRotationFromBlockFace

      public org.bukkit.Rotation getRotationFromBlockFace(@NotNull @NotNull org.bukkit.block.BlockFace face)
      Retrieves the Rotation corresponding to a given BlockFace.
      Parameters:
      face - The BlockFace for which to retrieve the rotation.
      Returns:
      The corresponding Rotation for the specified BlockFace.