PlayerEditor

interface PlayerEditor

DSL interface for editing player properties in a fluent and type-safe manner.

This interface provides a convenient way to modify various player attributes such as game mode, health, food level, experience, and more using Kotlin's DSL capabilities.

Example usage:

player.edit {
gameMode = GameMode.CREATIVE
health = 20.0
foodLevel = 20
level = 10
exp = 0.5f
sendMessage("Welcome to the game!")
teleport(spawnLocation)
}

See also

Properties

Link copied to clipboard
abstract var exp: Float

The player's experience progress towards the next level.

Link copied to clipboard
abstract var foodLevel: Int

The player's food level.

Link copied to clipboard
abstract var gameMode: GameMode

The player's current game mode.

Link copied to clipboard
abstract var health: Double

The player's health value.

Link copied to clipboard
abstract val inventory: Inventory

The player's inventory.

Link copied to clipboard
abstract var level: Int

The player's experience level.

Link copied to clipboard
abstract val player: Player

The player being edited.

Functions

Link copied to clipboard
abstract fun sendMessage(message: String)

Sends a plain text message to the player.

abstract fun sendMessage(message: Component)

Sends an Adventure Component message to the player.

Link copied to clipboard
abstract fun teleport(location: Location)

Teleports the player to the specified location.