Package com.zetaplugins.zetacore.util
Class LocationSerializer
java.lang.Object
com.zetaplugins.zetacore.util.LocationSerializer
Utility class for serializing and deserializing Location objects to and from string format.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic LocationdeserializeLocation(String serializedLocation) Deserializes a location string back into a Location object.static LocationdeserializeLocation(String serializedLocation, LocationSerializer.WorldProvider provider) Deserializes a location string back into a Location object.static StringserializeLocation(String worldName, double x, double y, double z, float yaw, float pitch) Serializes a location into a string format: "worldName,x,y,z,yaw,pitch"static StringserializeLocation(Location location) Serializes a Location object into a string format: "worldName,x,y,z,yaw,pitch"
-
Field Details
-
DEFAULT_PROVIDER
-
-
Method Details
-
serializeLocation
public static String serializeLocation(String worldName, double x, double y, double z, float yaw, float pitch) Serializes a location into a string format: "worldName,x,y,z,yaw,pitch"- Parameters:
worldName- The name of the worldx- The x coordinatey- The y coordinatez- The z coordinateyaw- The yaw rotationpitch- The pitch rotation- Returns:
- The serialized location string
-
serializeLocation
Serializes a Location object into a string format: "worldName,x,y,z,yaw,pitch"- Parameters:
location- The Location object to serialize- Returns:
- The serialized location string
-
deserializeLocation
public static Location deserializeLocation(String serializedLocation) throws LocationDeserializationException Deserializes a location string back into a Location object. Expects format: "worldName,x,y,z,yaw,pitch"- Parameters:
serializedLocation- The serialized location string- Returns:
- The deserialized Location object
- Throws:
LocationDeserializationException- if the string is malformed or the world does not exist
-
deserializeLocation
public static Location deserializeLocation(String serializedLocation, LocationSerializer.WorldProvider provider) throws LocationDeserializationException Deserializes a location string back into a Location object. Expects format: "worldName,x,y,z,yaw,pitch"- Parameters:
serializedLocation- The serialized location stringprovider- The WorldProvider to use for fetching worlds- Returns:
- The deserialized Location object
- Throws:
LocationDeserializationException- if the string is malformed or the world does not exist
-