WorldEditor

interface WorldEditor

DSL interface for editing Bukkit world properties.

This interface provides a type-safe DSL for modifying world settings, including time, weather, game rules, spawn location, difficulty, and more.

Use the World.edit extension function to access this DSL:

world.edit {
time = 6000L // Set to noon
weather = WeatherType.CLEAR
difficulty = Difficulty.HARD
}

Properties

Link copied to clipboard
abstract var difficulty: Difficulty

The difficulty level of the world.

Link copied to clipboard
abstract var doDaylightCycle: Boolean

Controls whether the day-night cycle progresses in the world.

Link copied to clipboard
abstract var doMobSpawning: Boolean

Controls whether mobs spawn naturally in the world.

Link copied to clipboard
abstract var doWeatherCycle: Boolean

Controls whether weather changes naturally in the world.

Link copied to clipboard
abstract var keepInventory: Boolean

Controls whether players keep their inventory on death.

Link copied to clipboard
abstract var spawnLocation: Location

The spawn location for the world.

Link copied to clipboard
abstract var time: Long

The current time of day in the world (0-24000).

Link copied to clipboard
abstract var weather: WeatherType

The current weather type in the world.

Link copied to clipboard
abstract val world: World

The world being edited.

Functions

Link copied to clipboard
abstract fun block(location: Location, action: BlockEditor.() -> Unit)

Edits a block at the specified location.

abstract fun block(x: Int, y: Int, z: Int, action: BlockEditor.() -> Unit)

Edits a block at the specified world coordinates.

Link copied to clipboard
abstract fun chunk(x: Int, z: Int, action: ChunkEditor.() -> Unit)

Edits a chunk at the specified coordinates.

Link copied to clipboard
abstract fun <T : Any> gameRule(rule: GameRule<T>, value: T)

Sets a game rule for the world.

Link copied to clipboard
abstract fun players(action: PlayerEditor.() -> Unit)

Applies an action to all players in the world.

abstract fun players(filter: (Player) -> Boolean, action: PlayerEditor.() -> Unit)

Applies an action to filtered players in the world.