Interface ServerWorldProperties
-
- All Superinterfaces:
GameRuleHolder
,Identifiable
,Keyed
,Nameable
,ResourceKeyed
,WeatherUniverse
,WeatherUniverse.Mutable
,WorldProperties
public interface ServerWorldProperties extends WorldProperties, Nameable, Identifiable, ResourceKeyed, WeatherUniverse.Mutable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
WeatherUniverse.Mutable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
commands()
Gets whether commands are enabled.java.util.List<KeyedValue<BossBar>>
customBossBars()
Gets the custombars
.java.util.Optional<Component>
displayName()
Gets thename
.GameMode
gameMode()
Gets the defaultGameMode
.boolean
initialized()
Gets if this has been initialized.boolean
loadOnStartup()
Gets whether this world will load when the server starts up.boolean
performsSpawnLogic()
Gets whether logic surrounding aspawn position
is performed.boolean
pvp()
Gets whether PVP combat is enabled.SerializationBehavior
serializationBehavior()
Gets theSerializationBehavior
.void
setCommands(boolean commands)
Sets whether commands are enabled.void
setCustomBossBars(@Nullable java.util.List<KeyedValue<BossBar>> bars)
Sets the custombars
.void
setDayTime(MinecraftDayTime time)
Sets the in-game time of day.void
setDifficulty(Difficulty difficulty)
Sets theDifficulty
.void
setDisplayName(@Nullable Component name)
Sets thename
.void
setGameMode(GameMode gameMode)
Sets theGameMode
.void
setHardcore(boolean hardcore)
Sets if this is in hardcore mode.void
setLoadOnStartup(boolean loadOnStartup)
Sets whether this should load when the server starts up.void
setPerformsSpawnLogic(boolean performsSpawnLogic)
Sets whether logic surrounding aspawn position
is performed.void
setPvp(boolean pvp)
Sets whether PVP combat is enabled.void
setSerializationBehavior(SerializationBehavior behavior)
Sets theSerializationBehavior
.void
setViewDistance(@Nullable java.lang.Integer viewDistance)
Sets the view distance (in chunks).void
setWanderingTrader(@Nullable WanderingTrader trader)
Sets theWanderingTrader
.void
setWanderingTraderSpawnChance(int chance)
Sets the chance that aWanderingTrader
will be spawned.void
setWanderingTraderSpawnDelay(Ticks delay)
Sets the delay before aWanderingTrader
will be spawned.void
setWorldType(WorldType worldType)
Sets theWorldType
.int
viewDistance()
Gets the view distance.int
wanderingTraderSpawnChance()
Gets the chance that aWanderingTrader
will be spawned, as a percentageTicks
wanderingTraderSpawnDelay()
Gets the delay before aWanderingTrader
will be spawned, in ticks.java.util.Optional<java.util.UUID>
wanderTraderUniqueId()
Gets theunique id
of theWanderingTrader
that has been spawned.java.util.Optional<ServerWorld>
world()
Gets theServerWorld
that correlates to this properties, if available.WorldGenerationConfig.Mutable
worldGenerationConfig()
Gets theWorldGenerationConfig
WorldType
worldType()
Gets theWorldType
.-
Methods inherited from interface org.spongepowered.api.world.gamerule.GameRuleHolder
gameRule, gameRules, setGameRule
-
Methods inherited from interface org.spongepowered.api.util.Identifiable
uniqueId
-
Methods inherited from interface org.spongepowered.api.ResourceKeyed
key
-
Methods inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
weather
-
Methods inherited from interface org.spongepowered.api.world.weather.WeatherUniverse.Mutable
setWeather, setWeather
-
Methods inherited from interface org.spongepowered.api.world.storage.WorldProperties
dayTime, difficulty, gameTime, hardcore, setSpawnPosition, spawnPosition, worldBorder
-
-
-
-
Method Detail
-
world
java.util.Optional<ServerWorld> world()
Gets theServerWorld
that correlates to this properties, if available.The rules are that the world must be loaded and it's
ServerWorld.key()
matches this properties'ResourceKeyed.key()
. Lastly, the properties of that world and this properties must be reference equal.- Returns:
- The world or
Optional.empty()
otherwise
-
setDisplayName
void setDisplayName(@Nullable Component name)
Sets thename
.- Parameters:
name
- The name
-
initialized
boolean initialized()
Gets if this has been initialized.- Returns:
- Is initialized
-
loadOnStartup
boolean loadOnStartup()
Gets whether this world will load when the server starts up.- Returns:
- Load on startup
-
setLoadOnStartup
void setLoadOnStartup(boolean loadOnStartup)
Sets whether this should load when the server starts up.- Parameters:
loadOnStartup
- Load on startup
-
performsSpawnLogic
boolean performsSpawnLogic()
Gets whether logic surrounding aspawn position
is performed.It is up to the implementation on how this setting is handled. For Vanilla Minecraft, the following occurs:
- If the world is new, a spawn point is calculated
- The chunks around the spawn point within a radius are kept loaded in memory
- Returns:
- performs spawn logic
-
setPerformsSpawnLogic
void setPerformsSpawnLogic(boolean performsSpawnLogic)
Sets whether logic surrounding aspawn position
is performed.It is up to the implementation on how this setting is handled. For Vanilla Minecraft, the following occurs:
- If the world is new, a spawn point is calculated
- The chunks around the spawn point within a radius are kept loaded in memory
- Parameters:
performsSpawnLogic
- Performs spawn logic
-
worldGenerationConfig
WorldGenerationConfig.Mutable worldGenerationConfig()
Gets theWorldGenerationConfig
- Returns:
- The world generation settings
-
setDayTime
void setDayTime(MinecraftDayTime time)
Sets the in-game time of day.- Parameters:
time
- The time of day
-
setWorldType
void setWorldType(WorldType worldType)
Sets theWorldType
.- Parameters:
worldType
- the type
-
pvp
boolean pvp()
Gets whether PVP combat is enabled.- Returns:
- pvp
-
setPvp
void setPvp(boolean pvp)
Sets whether PVP combat is enabled.- Parameters:
pvp
- pvp
-
setGameMode
void setGameMode(GameMode gameMode)
Sets theGameMode
.- Parameters:
gameMode
- game mode
-
setHardcore
void setHardcore(boolean hardcore)
Sets if this is in hardcore mode.- Parameters:
hardcore
- hardcore
-
commands
boolean commands()
Gets whether commands are enabled.It is up to the implementation to determine how this is respected.
- Returns:
- Commands
-
setCommands
void setCommands(boolean commands)
Sets whether commands are enabled.It is up to the implementation to determine how this is respected.
- Parameters:
commands
- commands
-
setDifficulty
void setDifficulty(Difficulty difficulty)
Sets theDifficulty
.- Parameters:
difficulty
- The difficulty
-
serializationBehavior
SerializationBehavior serializationBehavior()
Gets theSerializationBehavior
.- Returns:
- Serialization behavior
-
setSerializationBehavior
void setSerializationBehavior(SerializationBehavior behavior)
Sets theSerializationBehavior
.- Parameters:
behavior
- serialization behavior
-
wanderingTraderSpawnDelay
Ticks wanderingTraderSpawnDelay()
Gets the delay before aWanderingTrader
will be spawned, in ticks.In vanilla minecraft, 24,000 ticks is the default delay.
- Returns:
- The delay, in ticks
-
setWanderingTraderSpawnDelay
void setWanderingTraderSpawnDelay(Ticks delay)
Sets the delay before aWanderingTrader
will be spawned.- Parameters:
delay
- The delay, in ticks
-
wanderingTraderSpawnChance
int wanderingTraderSpawnChance()
Gets the chance that aWanderingTrader
will be spawned, as a percentageIn vanilla Minecraft, 25% is the default chance
- Returns:
- The delay, as a percentage
-
setWanderingTraderSpawnChance
void setWanderingTraderSpawnChance(int chance)
Sets the chance that aWanderingTrader
will be spawned.- Parameters:
chance
- The chance, as a percentage
-
wanderTraderUniqueId
java.util.Optional<java.util.UUID> wanderTraderUniqueId()
Gets theunique id
of theWanderingTrader
that has been spawned.- Returns:
- The unique id or
Optional.empty()
if one has not been spawned
-
setWanderingTrader
void setWanderingTrader(@Nullable WanderingTrader trader)
Sets theWanderingTrader
.In vanilla Minecraft, this will become the spawned trader.
- Parameters:
trader
- The trader
-
customBossBars
java.util.List<KeyedValue<BossBar>> customBossBars()
Gets the custombars
.- Returns:
- The boss bars
-
setCustomBossBars
void setCustomBossBars(@Nullable java.util.List<KeyedValue<BossBar>> bars)
Sets the custombars
.- Parameters:
bars
- The boss bars
-
viewDistance
int viewDistance()
Gets the view distance.In Vanilla Minecraft, this is in units of chunks and is considered the radius. Consult your specific implementation vendor for further details.
- Returns:
- View distance
-
setViewDistance
void setViewDistance(@Nullable java.lang.Integer viewDistance)
Sets the view distance (in chunks).In Vanilla Minecraft, this is in units of chunks and is considered the radius. Additionally it must be greater than 3 and less than or equal to 32.
Consult your specific implementation vendor for further details.
- Parameters:
viewDistance
- The view distance
-
-