Package me.yleoft.zAPI.location
Class LocationHandler
java.lang.Object
me.yleoft.zAPI.location.LocationHandler
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.Locationdeserialize(@NotNull String serialized) Deserializes a string into a Location object.static @Nullable org.bukkit.LocationfindNearestSafeLocation(@NotNull org.bukkit.Location origin, int radius, int heightCheckRange) Finds the nearest safe location from the given origin within a specified radius.static @NotNull CompletableFuture<org.bukkit.Location> findNearestSafeLocationAsync(@NotNull org.bukkit.Location origin, int radius, int heightCheckRange) static booleanisSafeLocation(@NotNull org.bukkit.Location loc) Checks if the given location is safe for a player to stand on.static @NotNull CompletableFuture<Boolean> isSafeLocationAsync(@NotNull org.bukkit.Location loc) static StringSerializes the given parameters into a string format.static Stringserialize(@NotNull org.bukkit.Location location) Serializes a Location object into a string format.
-
Constructor Details
-
LocationHandler
public LocationHandler()
-
-
Method Details
-
serialize
Serializes a Location object into a string format.- Parameters:
location- the Location to serialize- Returns:
- a string representation of the Location
-
serialize
public static String serialize(@NotNull @NotNull String world, double x, double y, double z, float yaw, float pitch) Serializes the given parameters into a string format.- Parameters:
world- the name of the worldx- the x-coordinatey- the y-coordinatez- the z-coordinateyaw- the yaw anglepitch- the pitch angle- Returns:
- a string representation of the parameters
-
deserialize
Deserializes a string into a Location object.- Parameters:
serialized- the serialized string- Returns:
- a Location object representing the serialized data
-
findNearestSafeLocation
@Nullable public static @Nullable org.bukkit.Location findNearestSafeLocation(@NotNull @NotNull org.bukkit.Location origin, int radius, int heightCheckRange) Finds the nearest safe location from the given origin within a specified radius.- Parameters:
origin- the starting locationradius- the search radiusheightCheckRange- the range to check for height variations- Returns:
- a safe location if found, otherwise null
-
findNearestSafeLocationAsync
@NotNull public static @NotNull CompletableFuture<org.bukkit.Location> findNearestSafeLocationAsync(@NotNull @NotNull org.bukkit.Location origin, int radius, int heightCheckRange) -
isSafeLocation
public static boolean isSafeLocation(@NotNull @NotNull org.bukkit.Location loc) Checks if the given location is safe for a player to stand on.- Parameters:
loc- the location to check- Returns:
- true if the location is safe, false otherwise
-
isSafeLocationAsync
@NotNull public static @NotNull CompletableFuture<Boolean> isSafeLocationAsync(@NotNull @NotNull org.bukkit.Location loc)
-