Class SimpleLocationManipulation
- java.lang.Object
-
- com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation
-
- All Implemented Interfaces:
LocationManipulation
public class SimpleLocationManipulation extends java.lang.Object implements LocationManipulation
The default-implementation ofLocationManipulation
.
-
-
Constructor Summary
Constructors Constructor Description SimpleLocationManipulation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bukkit.Location
getBlockLocation(org.bukkit.Location l)
This method simply does some rounding, rather than forcing a call to the server to get the blockdata.java.lang.String
getDirection(org.bukkit.Location location)
Return the NESW Direction a Location is facing.org.bukkit.Location
getNextBlock(org.bukkit.entity.Vehicle v)
Returns the next Location that aVehicle
is traveling at.float
getSpeed(org.bukkit.util.Vector v)
Returns a speed float from a given vector.org.bukkit.util.Vector
getTranslatedVector(org.bukkit.util.Vector v, java.lang.String direction)
Returns a translated vector from the given direction.float
getYaw(java.lang.String orientation)
Returns the float yaw position for the given cardinal direction.java.lang.String
locationToString(org.bukkit.Location location)
Convert a Location into a Colon separated string to allow us to store it in text.java.lang.String
strCoords(org.bukkit.Location l)
Returns a colored string with the coords.java.lang.String
strCoordsRaw(org.bukkit.Location l)
Converts a location to a printable readable formatted string including pitch/yaw.org.bukkit.Location
stringToLocation(java.lang.String locationString)
Returns a new location from a given string.
-
-
-
Method Detail
-
locationToString
public java.lang.String locationToString(org.bukkit.Location location)
Convert a Location into a Colon separated string to allow us to store it in text.WORLD:X,Y,Z:yaw:pitch
The corresponding String2Loc function is
LocationManipulation.stringToLocation(java.lang.String)
- Specified by:
locationToString
in interfaceLocationManipulation
- Parameters:
location
- The Location to save.- Returns:
- The location as a string in this format: WORLD:x,y,z:yaw:pitch
-
getBlockLocation
public org.bukkit.Location getBlockLocation(org.bukkit.Location l)
This method simply does some rounding, rather than forcing a call to the server to get the blockdata.- Specified by:
getBlockLocation
in interfaceLocationManipulation
- Parameters:
l
- The location to round to the block location- Returns:
- A rounded location.
-
stringToLocation
public org.bukkit.Location stringToLocation(java.lang.String locationString)
Returns a new location from a given string. The format is as follows:WORLD:X,Y,Z:yaw:pitch
The corresponding Location2String function is
LocationManipulation.stringToLocation(java.lang.String)
- Specified by:
stringToLocation
in interfaceLocationManipulation
- Parameters:
locationString
- The location represented as a string (WORLD:X,Y,Z:yaw:pitch)- Returns:
- A new location defined by the string or null if the string was invalid.
-
strCoords
public java.lang.String strCoords(org.bukkit.Location l)
Returns a colored string with the coords.- Specified by:
strCoords
in interfaceLocationManipulation
- Parameters:
l
- TheLocation
- Returns:
- The
String
-
strCoordsRaw
public java.lang.String strCoordsRaw(org.bukkit.Location l)
Converts a location to a printable readable formatted string including pitch/yaw.- Specified by:
strCoordsRaw
in interfaceLocationManipulation
- Parameters:
l
- TheLocation
- Returns:
- The
String
-
getDirection
public java.lang.String getDirection(org.bukkit.Location location)
Return the NESW Direction a Location is facing.- Specified by:
getDirection
in interfaceLocationManipulation
- Parameters:
location
- TheLocation
- Returns:
- The NESW Direction
-
getYaw
public float getYaw(java.lang.String orientation)
Returns the float yaw position for the given cardinal direction.- Specified by:
getYaw
in interfaceLocationManipulation
- Parameters:
orientation
- The cardinal direction- Returns:
- The yaw
-
getSpeed
public float getSpeed(org.bukkit.util.Vector v)
Returns a speed float from a given vector.- Specified by:
getSpeed
in interfaceLocationManipulation
- Parameters:
v
- TheVector
- Returns:
- The speed
-
getTranslatedVector
public org.bukkit.util.Vector getTranslatedVector(org.bukkit.util.Vector v, java.lang.String direction)
Returns a translated vector from the given direction.- Specified by:
getTranslatedVector
in interfaceLocationManipulation
- Parameters:
v
- The oldVector
direction
- The new direction- Returns:
- The translated
Vector
-
getNextBlock
public org.bukkit.Location getNextBlock(org.bukkit.entity.Vehicle v)
Returns the next Location that aVehicle
is traveling at.- Specified by:
getNextBlock
in interfaceLocationManipulation
- Parameters:
v
- TheVehicle
- Returns:
- The
Location
-
-