Class RespawnLocation

java.lang.Object
org.spongepowered.api.util.RespawnLocation
All Implemented Interfaces:
DataSerializable

public final class RespawnLocation extends Object implements DataSerializable
Represents a position for a player to respawn in in a particular world. Instances can be obtained using Keys.RESPAWN_LOCATIONS or by using the builder().
  • Method Details

    • builder

      public static RespawnLocation.Builder builder()
      Creates a new RespawnLocation.Builder to build a RespawnLocation.
      Returns:
      A new builder
    • worldKey

      public ResourceKey worldKey()
      Gets the key of the world.
      Returns:
      The key
    • position

      public Vector3d position()
      Gets the position within the world of this spawn point.
      Returns:
      The spawn position
    • isForced

      public boolean isForced()
      Gets whether the spawn position is forced in the given world, if available. A forced position will spawn the player there even if a bed is missing or obstructed.
      Returns:
      Whether the position is forced in the world
    • asLocation

      public Optional<ServerLocation> asLocation()
      Gets this spawn position as a ServerLocation object, if the world is available.
      Returns:
      The position object, if available.
    • contentVersion

      public int contentVersion()
      Description copied from interface: DataSerializable
      Gets the content version of this DataSerializable. The version may differ between instances of plugins and implementations such that the DataView from DataSerializable.toContainer() may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand with DataContentUpdater as it is required when there exists any DataView of this DataSerializable with an "older" version.
      Specified by:
      contentVersion in interface DataSerializable
      Returns:
      The version of the content being serialized
    • toContainer

      public DataContainer toContainer()
      Description copied from interface: DataSerializable
      Serializes this object into a comprehensible DataContainer.
      Specified by:
      toContainer in interface DataSerializable
      Returns:
      A newly created DataContainer
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object