Package dev.cwhead.GravesX.api.world
Class LocationAPI
java.lang.Object
dev.cwhead.GravesX.api.world.LocationAPI
World/location helper API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationchunkStringToLocation(@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.LocationgetClosestLocation(@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.RotationgetRotationFromBlockFace(@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.LocationroundLocation(@NotNull org.bukkit.Location location) Rounds the given location's coordinates to the nearest whole numbers.org.bukkit.block.BlockFacesimplifyBlockFace(@NotNull org.bukkit.block.BlockFace face) Simplifies a given BlockFace to one of the four cardinal directions (NORTH, EAST, SOUTH, WEST).org.bukkit.LocationstringToLocation(@NotNull String string) Converts a string representation of a location back to a Location object.
-
Constructor Details
-
LocationAPI
-
-
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
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
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
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
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.
-