public interface WorldProperties extends DataSerializable
World
which are persisted across runtime instances.Modifier and Type | Method and Description |
---|---|
boolean |
areCommandsAllowed()
Gets whether commands are allowed within this world.
|
boolean |
doesGenerateBonusChest()
Gets whether the bonus chest should be generated.
|
boolean |
doesGenerateSpawnOnLoad()
Gets whether spawn chunks of this world will generate on load.
|
boolean |
doesKeepSpawnLoaded()
Gets whether spawn chunks of this world remain loaded when no players are
present.
|
DataContainer |
getAdditionalProperties()
Gets a
DataContainer containing any additional properties for
this world. |
Difficulty |
getDifficulty()
Gets the difficulty of this world.
|
DimensionType |
getDimensionType()
Gets the
DimensionType of this world. |
GameMode |
getGameMode()
Gets the default
GameMode of this world. |
Optional<String> |
getGameRule(String gameRule)
Gets the specified GameRule value.
|
Map<String,String> |
getGameRules()
Gets a map of the currently set game rules and their values.
|
Collection<WorldGeneratorModifier> |
getGeneratorModifiers()
Gets an immutable collection of the world generator modifiers currently
in use.
|
DataContainer |
getGeneratorSettings()
Gets the generator settings.
|
GeneratorType |
getGeneratorType()
Gets the
GeneratorType of this world. |
PortalAgentType |
getPortalAgentType()
Gets the
PortalAgentType for the world. |
Optional<DataView> |
getPropertySection(DataQuery path)
Gets a section of the additional properties returned by
getAdditionalProperties() . |
int |
getRainTime()
Gets the number of ticks until the weather is next toggled to a new
random value.
|
long |
getSeed()
Gets the seed of this world.
|
SerializationBehavior |
getSerializationBehavior()
Gets the
SerializationBehavior in use. |
com.flowpowered.math.vector.Vector3i |
getSpawnPosition()
Gets the default spawn position of this world.
|
int |
getThunderTime()
Gets the number of ticks until the
isThundering() state is
toggled to a new random value. |
long |
getTotalTime()
Gets the number of ticks which have occurred since the world was created.
|
UUID |
getUniqueId()
Gets the
UUID of the world. |
com.flowpowered.math.vector.Vector3d |
getWorldBorderCenter()
Gets the center of the world border.
|
double |
getWorldBorderDamageAmount()
Gets the damage done to a player per block per tick when outside the
buffer.
|
double |
getWorldBorderDamageThreshold()
Gets the distance a player may be outside the world border before taking
damage.
|
double |
getWorldBorderDiameter()
Gets the diameter of the world border.
|
double |
getWorldBorderTargetDiameter()
Gets the diameter the world border is expanding or contracting to.
|
long |
getWorldBorderTimeRemaining()
Gets the time remaining until the world border stops expanding or
contracting.
|
int |
getWorldBorderWarningDistance()
Gets the distance when a contracting world border will warn a player for
whom the world border is
distance blocks away. |
int |
getWorldBorderWarningTime()
Gets the time when a contracting world border will warn a player for whom
the world border will reach in
time seconds. |
String |
getWorldName()
Gets the name of this world.
|
long |
getWorldTime()
Gets the time of day, in ticks.
|
boolean |
isEnabled()
Gets whether this world is enabled.
|
boolean |
isHardcore()
Gets whether this world is set to hardcore mode.
|
boolean |
isInitialized()
Gets whether this world has been initialized.
|
boolean |
isPVPEnabled()
Gets whether PVP combat is enabled in this world.
|
boolean |
isRaining()
Gets whether this world is currently experiencing rain/snow/cloud-cover
(depending on the biome of a specific location).
|
boolean |
isThundering()
Gets whether this world is currently experiencing a lightning storm.
|
boolean |
loadOnStartup()
Gets whether this world will load when the server starts up.
|
boolean |
removeGameRule(String gameRule)
Removes custom GameRule.
|
void |
setCommandsAllowed(boolean state)
Sets whether commands are allowed within this world.
|
void |
setDifficulty(Difficulty difficulty)
Sets the difficulty of this world.
|
void |
setEnabled(boolean state)
Sets this world as enabled.
|
void |
setGameMode(GameMode gamemode)
Sets the default
GameMode of this world. |
void |
setGameRule(String gameRule,
String value)
Sets the specified GameRule value.
|
void |
setGenerateSpawnOnLoad(boolean state)
Sets whether the spawn chunks of the world will generate on load.
|
void |
setGeneratorModifiers(Collection<WorldGeneratorModifier> modifiers)
Sets the given world generator modifiers to be used.
|
void |
setGeneratorType(GeneratorType type)
Sets the
GeneratorType of this world. |
void |
setHardcore(boolean state)
Sets whether this world is set to hardcore mode.
|
void |
setKeepSpawnLoaded(boolean state)
Sets whether the spawn chunks of the world should remain loaded when no
players are present.
|
void |
setLoadOnStartup(boolean state)
Sets whether this world should load when the server starts up.
|
void |
setMapFeaturesEnabled(boolean state)
Sets whether this world will generate map features such as villages and
strongholds.
|
void |
setPropertySection(DataQuery path,
DataView data)
Sets a path within the additional data to the given
DataView . |
void |
setPVPEnabled(boolean enabled)
Sets whether PVP combat is enabled in this world.
|
void |
setRaining(boolean state)
Sets whether this world is currently experiencing rain/snow/cloud-cover
(depending on the biome of a specific location).
|
void |
setRainTime(int time)
Sets the number of ticks until the weather is next toggled to a new
random value.
|
void |
setSeed(long seed)
Sets the seed of this world.
|
void |
setSerializationBehavior(SerializationBehavior behavior)
Sets the
SerializationBehavior for use. |
void |
setSpawnPosition(com.flowpowered.math.vector.Vector3i position)
Sets the default spawn position of this world.
|
void |
setThundering(boolean state)
Sets whether this world is currently experiencing a lightning storm.
|
void |
setThunderTime(int time)
Sets the number of ticks until the
isThundering() state is
toggled to a new random value. |
void |
setWorldBorderCenter(double x,
double z)
Sets the center of the world border.
|
void |
setWorldBorderDamageAmount(double damage)
Sets the damage done to a player per block per tick when outside the
buffer.
|
void |
setWorldBorderDamageThreshold(double distance)
Sets the distance a player may be be outside the world border before
taking damage.
|
void |
setWorldBorderDiameter(double diameter)
Sets the diameter of the world border.
|
void |
setWorldBorderTargetDiameter(double diameter)
Sets the target diameter of the world border.
|
void |
setWorldBorderTimeRemaining(long time)
Sets the time remaining until the world border stops expanding or
contracting.
|
void |
setWorldBorderWarningDistance(int distance)
Sets the distance when a contracting world border will warn a player for
whom the world border is
distance blocks away. |
void |
setWorldBorderWarningTime(int time)
Sets the time when a contracting world border will warn a player for whom
the world border will reach in
time seconds. |
void |
setWorldTime(long time)
Sets the time of day, in ticks.
|
boolean |
usesMapFeatures()
Gets whether this world will generate map features such as villages and
strongholds.
|
getContentVersion, toContainer
boolean isInitialized()
String getWorldName()
boolean isEnabled()
Entity.transferToWorld(org.spongepowered.api.world.World)
.void setEnabled(boolean state)
Entity.transferToWorld(org.spongepowered.api.world.World)
.state
- The new stateboolean loadOnStartup()
void setLoadOnStartup(boolean state)
state
- Should load on startupboolean doesKeepSpawnLoaded()
void setKeepSpawnLoaded(boolean state)
state
- Should keep spawn loadedboolean doesGenerateSpawnOnLoad()
void setGenerateSpawnOnLoad(boolean state)
state
- Should generate spawn chunks on load.com.flowpowered.math.vector.Vector3i getSpawnPosition()
void setSpawnPosition(com.flowpowered.math.vector.Vector3i position)
position
- The spawn positionGeneratorType getGeneratorType()
GeneratorType
of this world.void setGeneratorType(GeneratorType type)
GeneratorType
of this world.type
- The generator typelong getSeed()
void setSeed(long seed)
Warning: this may cause the edge of currently generated chunks to no longer align with newly generated chunks.
seed
- The new world seedlong getTotalTime()
long getWorldTime()
void setWorldTime(long time)
time
- The time of dayDimensionType getDimensionType()
DimensionType
of this world.PortalAgentType getPortalAgentType()
PortalAgentType
for the world.boolean isPVPEnabled()
void setPVPEnabled(boolean enabled)
enabled
- Whether PVP is enabledboolean isRaining()
void setRaining(boolean state)
state
- Is rainingint getRainTime()
void setRainTime(int time)
time
- The time until the weather changesboolean isThundering()
void setThundering(boolean state)
state
- Is thunderingint getThunderTime()
isThundering()
state is
toggled to a new random value.void setThunderTime(int time)
isThundering()
state is
toggled to a new random value.time
- The time until the thundering state changesvoid setGameMode(GameMode gamemode)
GameMode
of this world.gamemode
- The game modeboolean usesMapFeatures()
void setMapFeaturesEnabled(boolean state)
state
- Whether map features enabledboolean isHardcore()
void setHardcore(boolean state)
state
- Is hardcoreboolean areCommandsAllowed()
void setCommandsAllowed(boolean state)
state
- Whether commands are allowedDifficulty getDifficulty()
void setDifficulty(Difficulty difficulty)
difficulty
- The difficultyboolean doesGenerateBonusChest()
This only applies on the initial load of the World
created via this properties.
com.flowpowered.math.vector.Vector3d getWorldBorderCenter()
The returned position is three-dimensional. As the world border
extends over the entire y-axis, the returned position will always have a
y
set to 0.
void setWorldBorderCenter(double x, double z)
x
- The x-axis center of the world borderz
- The z-axis center of the world borderdouble getWorldBorderDiameter()
The returned diameter applies to the x and z axis. The world border extends over the entire y-axis.
void setWorldBorderDiameter(double diameter)
The specified diameter applies to the x and z axis. The world border extends over the entire y-axis.
diameter
- The diameterlong getWorldBorderTimeRemaining()
void setWorldBorderTimeRemaining(long time)
time
- The new remaining timedouble getWorldBorderTargetDiameter()
This will return the same value as getWorldBorderDiameter()
unless getWorldBorderTimeRemaining()
is greater than 0.
void setWorldBorderTargetDiameter(double diameter)
The world border diameter increases/decrease linearly over time
specified in getWorldBorderTimeRemaining()
. The specified
diameter applies to the x and z axis. The world border extends over the
entire y-axis.
diameter
- The diameter where the border will expand/contract todouble getWorldBorderDamageThreshold()
void setWorldBorderDamageThreshold(double distance)
distance
- The distancedouble getWorldBorderDamageAmount()
void setWorldBorderDamageAmount(double damage)
damage
- The damage amountint getWorldBorderWarningTime()
time
seconds.
In Minecraft, the warning is displayed in the form of a reddish tint.
void setWorldBorderWarningTime(int time)
time
seconds.
In Minecraft, the warning is displayed in the form of a reddish tint.
time
- The time, in secondsint getWorldBorderWarningDistance()
distance
blocks away.
In Minecraft, the warning is displayed in the form of a reddish tint.
void setWorldBorderWarningDistance(int distance)
distance
blocks away.
In Minecraft, the warning is displayed in the form of a reddish tint.
distance
- The distance, in blocksOptional<String> getGameRule(String gameRule)
gameRule
- The name of the GameRule.Map<String,String> getGameRules()
void setGameRule(String gameRule, String value)
gameRule
- The name of the GameRule.value
- The value to set the GameRule to.boolean removeGameRule(String gameRule)
gameRule
- The name of the GameRule.DataContainer getAdditionalProperties()
DataContainer
containing any additional properties for
this world. The returned data is a snapshot of the data and is not live.Optional<DataView> getPropertySection(DataQuery path)
getAdditionalProperties()
. The returned data is a snapshot of
the data and is not live.path
- The path for the section.void setPropertySection(DataQuery path, DataView data)
DataView
. If
you are using this to store data related to your mod/plugin is is HIGHLY
recommended that the identifier you pass in be your mod/plugin id.path
- The path for the sectiondata
- The new dataCollection<WorldGeneratorModifier> getGeneratorModifiers()
void setGeneratorModifiers(Collection<WorldGeneratorModifier> modifiers)
modifiers
- The modifiers to set.IllegalArgumentException
- If any of the modifiers has not been
registered in the GameRegistry
.DataContainer getGeneratorSettings()
SerializationBehavior getSerializationBehavior()
SerializationBehavior
in use.void setSerializationBehavior(SerializationBehavior behavior)
SerializationBehavior
for use.behavior
- The serialization behavior