Class LocationSerializer

java.lang.Object
com.zetaplugins.zetacore.util.LocationSerializer

public final class LocationSerializer extends Object
Utility class for serializing and deserializing Location objects to and from string format.
  • Field Details

  • 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 world
      x - The x coordinate
      y - The y coordinate
      z - The z coordinate
      yaw - The yaw rotation
      pitch - The pitch rotation
      Returns:
      The serialized location string
    • serializeLocation

      public static String serializeLocation(Location location)
      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 string
      provider - 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