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>
,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 build
RespawnLocation
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a newRespawnLocation
from this builder.protected 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)
.forceSpawn
(boolean isForced) Sets whether the position to respawn at is forced or can be varied for safety.from
(RespawnLocation value) Resets this builder to the values of the given built object.location
(ServerLocation location) Sets theVector3d
position of where to respawn at.reset()
Resets this builder to a "default" state such that there is no remaining data to set.world
(ResourceKey key) Sets thekey
tied to the desiredServerWorld
.world
(ServerWorld world) Sets thekey
of the providedServerWorld
onto this builder.Methods inherited from class org.spongepowered.api.data.persistence.AbstractDataBuilder
build
-
Constructor Details
-
Builder
public Builder()Creates a newRespawnLocation.Builder
.
-
-
Method Details
-
world
Sets thekey
of the providedServerWorld
onto this builder.- Parameters:
world
- The world- Returns:
- This builder, for chaining
-
world
Sets thekey
tied to the desiredServerWorld
.- Parameters:
key
- The key- Returns:
- This builder, for chaining
-
location
- Parameters:
location
- The location desired- Returns:
- This builder, for chaining
-
position
Sets theVector3d
position of where to respawn at.- Parameters:
position
- The position to respawn at- Returns:
- This builder, for chaining
-
forceSpawn
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
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
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
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
Creates a newRespawnLocation
from this builder.- Specified by:
build
in interfaceAbstractBuilder<RespawnLocation>
- Returns:
- The new respawn location
-