Package com.sk89q.commandbook.util
Class LocationUtil
java.lang.Object
com.sk89q.commandbook.util.LocationUtil
public class LocationUtil
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description LocationUtil() -
Method Summary
Modifier and Type Method Description static doubledistanceSquared2D(org.bukkit.Location a, org.bukkit.Location b)Get the 2D distance between two points a and b.static org.bukkit.WorldextractWorld(org.bukkit.command.CommandSender sender)Try to extract the world of a command sender.static org.bukkit.LocationfindFreePosition(org.bukkit.Location searchPos)Find a position for the player to stand that is not inside a block.static org.bukkit.LocationgetManagedLocation(RootLocationManager<NamedLocation> manager, org.bukkit.World world, java.lang.String id)Get a location from a location manager.
-
Constructor Details
-
LocationUtil
public LocationUtil()
-
-
Method Details
-
findFreePosition
public static org.bukkit.Location findFreePosition(org.bukkit.Location searchPos)Find a position for the player to stand that is not inside a block. Blocks above the player will be iteratively tested until there is a series of two free blocks. The player will be teleported to that free position.- Parameters:
searchPos- search position- Returns:
-
extractWorld
public static org.bukkit.World extractWorld(org.bukkit.command.CommandSender sender)Try to extract the world of a command sender.- Parameters:
sender- command sender- Returns:
- world or null
-
getManagedLocation
public static org.bukkit.Location getManagedLocation(RootLocationManager<NamedLocation> manager, org.bukkit.World world, java.lang.String id) throws com.sk89q.minecraft.util.commands.CommandExceptionGet a location from a location manager.- Parameters:
manager- RootLocationManager to look inworld-id- name of the location- Returns:
- a Bukkit location
- Throws:
com.sk89q.minecraft.util.commands.CommandException- if the location by said id does not exist
-
distanceSquared2D
public static double distanceSquared2D(org.bukkit.Location a, org.bukkit.Location b)Get the 2D distance between two points a and b.- Parameters:
a- first locationb- second location- Returns:
- squared 2D distance between the two points
-