Interface ServerWorldProperties
- All Superinterfaces:
GameRuleHolder
,Identifiable
,Keyed
,Nameable
,ResourceKeyed
,WeatherUniverse
,WeatherUniverse.Mutable
,WorldProperties
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.world.weather.WeatherUniverse
WeatherUniverse.Mutable
-
Method Summary
Modifier and TypeMethodDescriptionboolean
commands()
Gets whether commands are enabled.Gets the custombars
.Gets thename
.gameMode()
Gets the defaultGameMode
.boolean
Gets if this has been initialized.boolean
Gets whether this world will load when the server starts up.boolean
Gets whether logic surrounding aspawn position
is performed.boolean
pvp()
Gets whether PVP combat is enabled.Gets theSerializationBehavior
.void
setCommands
(boolean commands) Sets whether commands are enabled.void
setCustomBossBars
(@Nullable 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
Sets theSerializationBehavior
.void
setViewDistance
(@Nullable 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
Sets the delay before aWanderingTrader
will be spawned.void
setWorldType
(WorldType worldType) Sets theWorldType
.int
Gets the view distance.int
Gets the chance that aWanderingTrader
will be spawned, as a percentageGets the delay before aWanderingTrader
will be spawned, in ticks.Gets theunique id
of theWanderingTrader
that has been spawned.world()
Gets theServerWorld
that correlates to this properties, if available.Gets theWorldGenerationConfig
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 Details
-
world
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
-
displayName
Gets thename
.- Returns:
- The name
-
setDisplayName
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
Sets the in-game time of day.- Parameters:
time
- The time of day
-
worldType
WorldType worldType()Gets theWorldType
.- Returns:
- The world type
-
setWorldType
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
-
gameMode
GameMode gameMode()Gets the defaultGameMode
.- Returns:
- The game mode
-
setGameMode
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
Sets theDifficulty
.- Parameters:
difficulty
- The difficulty
-
serializationBehavior
SerializationBehavior serializationBehavior()Gets theSerializationBehavior
.- Returns:
- Serialization behavior
-
setSerializationBehavior
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
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
Gets theunique id
of theWanderingTrader
that has been spawned.- Returns:
- The unique id or
Optional.empty()
if one has not been spawned
-
setWanderingTrader
Sets theWanderingTrader
.In vanilla Minecraft, this will become the spawned trader.
- Parameters:
trader
- The trader
-
customBossBars
List<KeyedValue<BossBar>> customBossBars()Gets the custombars
.- Returns:
- The boss bars
-
setCustomBossBars
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
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
-