Package org.spongepowered.api.util
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 usingKeys.RESPAWN_LOCATIONSor by using thebuilder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRespawnLocation.BuilderA helper class to buildRespawnLocations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<ServerLocation>asLocation()Gets this spawn position as aServerLocationobject, if the world is available.static RespawnLocation.Builderbuilder()Creates a newRespawnLocation.Builderto build aRespawnLocation.intcontentVersion()Gets the content version of thisDataSerializable.booleanequals(Object o)inthashCode()booleanisForced()Gets whether the spawn position is forced in the given world, if available.Vector3dposition()Gets the position within the world of this spawn point.DataContainertoContainer()Serializes this object into a comprehensibleDataContainer.StringtoString()ResourceKeyworldKey()Gets thekeyof the world.
-
-
-
Method Detail
-
builder
public static RespawnLocation.Builder builder()
Creates a newRespawnLocation.Builderto build aRespawnLocation.- Returns:
- A new builder
-
worldKey
public ResourceKey worldKey()
Gets thekeyof 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 aServerLocationobject, if the world is available.- Returns:
- The position object, if available.
-
contentVersion
public int contentVersion()
Description copied from interface:DataSerializableGets the content version of thisDataSerializable. The version may differ between instances of plugins and implementations such that theDataViewfromDataSerializable.toContainer()may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand withDataContentUpdateras it is required when there exists anyDataViewof thisDataSerializablewith an "older" version.- Specified by:
contentVersionin interfaceDataSerializable- Returns:
- The version of the content being serialized
-
toContainer
public DataContainer toContainer()
Description copied from interface:DataSerializableSerializes this object into a comprehensibleDataContainer.- Specified by:
toContainerin interfaceDataSerializable- Returns:
- A newly created DataContainer
-
-