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.LocationgetBlockLocation(org.bukkit.Location l)This method simply does some rounding, rather than forcing a call to the server to get the blockdata.java.lang.StringgetDirection(org.bukkit.Location location)Return the NESW Direction a Location is facing.org.bukkit.LocationgetNextBlock(org.bukkit.entity.Vehicle v)Returns the next Location that aVehicleis traveling at.floatgetSpeed(org.bukkit.util.Vector v)Returns a speed float from a given vector.org.bukkit.util.VectorgetTranslatedVector(org.bukkit.util.Vector v, java.lang.String direction)Returns a translated vector from the given direction.floatgetYaw(java.lang.String orientation)Returns the float yaw position for the given cardinal direction.java.lang.StringlocationToString(org.bukkit.Location location)Convert a Location into a Colon separated string to allow us to store it in text.java.lang.StringstrCoords(org.bukkit.Location l)Returns a colored string with the coords.java.lang.StringstrCoordsRaw(org.bukkit.Location l)Converts a location to a printable readable formatted string including pitch/yaw.org.bukkit.LocationstringToLocation(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:
locationToStringin 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:
getBlockLocationin 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:
stringToLocationin 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:
strCoordsin 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:
strCoordsRawin 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:
getDirectionin 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:
getYawin 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:
getSpeedin 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:
getTranslatedVectorin interfaceLocationManipulation- Parameters:
v- The oldVectordirection- The new direction- Returns:
- The translated
Vector
-
getNextBlock
public org.bukkit.Location getNextBlock(org.bukkit.entity.Vehicle v)
Returns the next Location that aVehicleis traveling at.- Specified by:
getNextBlockin interfaceLocationManipulation- Parameters:
v- TheVehicle- Returns:
- The
Location
-
-