Package org.spongepowered.api.util
Class RespawnLocation.Builder
- java.lang.Object
-
- org.spongepowered.api.data.persistence.AbstractDataBuilder<RespawnLocation>
-
- org.spongepowered.api.util.RespawnLocation.Builder
-
- All Implemented Interfaces:
AbstractBuilder<RespawnLocation>
,Buildable.Builder<RespawnLocation>
,DataBuilder<RespawnLocation>
,Builder<RespawnLocation,RespawnLocation.Builder>
,CopyableBuilder<RespawnLocation,RespawnLocation.Builder>
,ResettableBuilder<RespawnLocation,RespawnLocation.Builder>
- Enclosing class:
- RespawnLocation
public static final class RespawnLocation.Builder extends AbstractDataBuilder<RespawnLocation> implements Builder<RespawnLocation,RespawnLocation.Builder>, CopyableBuilder<RespawnLocation,RespawnLocation.Builder>
A helper class to buildRespawnLocation
s.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a newRespawnLocation.Builder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RespawnLocation
build()
Creates a newRespawnLocation
from this builder.protected java.util.Optional<RespawnLocation>
buildContent(DataView container)
Builds the currentlyAbstractDataBuilder.supportedVersion
variant of the intendedDataSerializable
, such that all content upgrades have already been handled byAbstractDataBuilder.build(DataView)
.RespawnLocation.Builder
forceSpawn(boolean isForced)
Sets whether the position to respawn at is forced or can be varied for safety.RespawnLocation.Builder
from(RespawnLocation value)
Resets this builder to the values of the given built object.RespawnLocation.Builder
location(ServerLocation location)
RespawnLocation.Builder
position(Vector3d position)
Sets theVector3d
position of where to respawn at.RespawnLocation.Builder
reset()
Resets this builder to a "default" state such that there is no remaining data to set.RespawnLocation.Builder
world(ResourceKey key)
Sets thekey
tied to the desiredServerWorld
.RespawnLocation.Builder
world(ServerWorld world)
Sets thekey
of the providedServerWorld
onto this builder.-
Methods inherited from class org.spongepowered.api.data.persistence.AbstractDataBuilder
build
-
-
-
-
Constructor Detail
-
Builder
public Builder()
Creates a newRespawnLocation.Builder
.
-
-
Method Detail
-
world
public RespawnLocation.Builder world(ServerWorld world)
Sets thekey
of the providedServerWorld
onto this builder.- Parameters:
world
- The world- Returns:
- This builder, for chaining
-
world
public RespawnLocation.Builder world(ResourceKey key)
Sets thekey
tied to the desiredServerWorld
.- Parameters:
key
- The key- Returns:
- This builder, for chaining
-
location
public RespawnLocation.Builder location(ServerLocation location)
- Parameters:
location
- The location desired- Returns:
- This builder, for chaining
-
position
public RespawnLocation.Builder position(Vector3d position)
Sets theVector3d
position of where to respawn at.- Parameters:
position
- The position to respawn at- Returns:
- This builder, for chaining
-
forceSpawn
public RespawnLocation.Builder forceSpawn(boolean isForced)
Sets whether the position to respawn at is forced or can be varied for safety.- Parameters:
isForced
- If the respawn position is forced- Returns:
- This builder, for chaining
-
buildContent
protected java.util.Optional<RespawnLocation> buildContent(DataView container) throws InvalidDataException
Description copied from class:AbstractDataBuilder
Builds the currentlyAbstractDataBuilder.supportedVersion
variant of the intendedDataSerializable
, such that all content upgrades have already been handled byAbstractDataBuilder.build(DataView)
. This otherwise follows the same contract asDataBuilder.build(DataView)
.- Specified by:
buildContent
in classAbstractDataBuilder<RespawnLocation>
- Parameters:
container
- The container with data to build from- Returns:
- The deserialized data serializable, if possible
- Throws:
InvalidDataException
- If there's issues of invalid data formats or invalid data
-
reset
public RespawnLocation.Builder reset()
Description copied from interface:Builder
Resets this builder to a "default" state such that there is no remaining data to set. This is to be the presumed "default" state.- Specified by:
reset
in interfaceBuilder<RespawnLocation,RespawnLocation.Builder>
- Specified by:
reset
in interfaceResettableBuilder<RespawnLocation,RespawnLocation.Builder>
- Returns:
- This builder, for chaining
-
from
public RespawnLocation.Builder from(RespawnLocation value)
Description copied from interface:CopyableBuilder
Resets this builder to the values of the given built object.- Specified by:
from
in interfaceCopyableBuilder<RespawnLocation,RespawnLocation.Builder>
- Parameters:
value
- The built object- Returns:
- This builder, for chaining
-
build
public RespawnLocation build()
Creates a newRespawnLocation
from this builder.- Specified by:
build
in interfaceAbstractBuilder<RespawnLocation>
- Specified by:
build
in interfaceBuildable.Builder<RespawnLocation>
- Returns:
- The new respawn location
-
-