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 buildRespawnLocations.
-
-
Constructor Summary
Constructors Constructor Description Builder()Creates a newRespawnLocation.Builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RespawnLocationbuild()Creates a newRespawnLocationfrom this builder.protected Optional<RespawnLocation>buildContent(DataView container)Builds the currentlyAbstractDataBuilder.supportedVersionvariant of the intendedDataSerializable, such that all content upgrades have already been handled byAbstractDataBuilder.build(DataView).RespawnLocation.BuilderforceSpawn(boolean isForced)Sets whether the position to respawn at is forced or can be varied for safety.RespawnLocation.Builderfrom(RespawnLocation value)Resets this builder to the values of the given built object.RespawnLocation.Builderlocation(ServerLocation location)RespawnLocation.Builderposition(Vector3d position)Sets theVector3dposition of where to respawn at.RespawnLocation.Builderreset()Resets this builder to a "default" state such that there is no remaining data to set.RespawnLocation.Builderworld(ResourceKey key)Sets thekeytied to the desiredServerWorld.RespawnLocation.Builderworld(ServerWorld world)Sets thekeyof the providedServerWorldonto 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 thekeyof the providedServerWorldonto this builder.- Parameters:
world- The world- Returns:
- This builder, for chaining
-
world
public RespawnLocation.Builder world(ResourceKey key)
Sets thekeytied 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 theVector3dposition 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 Optional<RespawnLocation> buildContent(DataView container) throws InvalidDataException
Description copied from class:AbstractDataBuilderBuilds the currentlyAbstractDataBuilder.supportedVersionvariant 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:
buildContentin 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:BuilderResets 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:
resetin interfaceBuilder<RespawnLocation,RespawnLocation.Builder>- Specified by:
resetin interfaceResettableBuilder<RespawnLocation,RespawnLocation.Builder>- Returns:
- This builder, for chaining
-
from
public RespawnLocation.Builder from(RespawnLocation value)
Description copied from interface:CopyableBuilderResets this builder to the values of the given built object.- Specified by:
fromin interfaceCopyableBuilder<RespawnLocation,RespawnLocation.Builder>- Parameters:
value- The built object- Returns:
- This builder, for chaining
-
build
public RespawnLocation build()
Creates a newRespawnLocationfrom this builder.- Specified by:
buildin interfaceAbstractBuilder<RespawnLocation>- Specified by:
buildin interfaceBuildable.Builder<RespawnLocation>- Returns:
- The new respawn location
-
-