val players: KattonPlayerListAccess to all online players.
Common
val players: KattonPlayerListAccess to all online players.
val entities: KattonServerEntityCollectionAccess to all entities across all levels.
val storage: CommandStorageServer command storage for persistent data.
val scoreboard: ScoreboardServer scoreboard instance.
var difficulty: DifficultyCurrent server difficulty setting.
fun execute(command: String)Execute a command string.
| Parameter | Description |
|---|---|
command | the command string to execute |
fun executeCommand(source: CommandSourceStack, command: String)Execute a command as the provided command source.
| Parameter | Description |
|---|---|
source | the command source to run the command as |
command | the command string to execute |
fun executeCommandAsServer(command: String)Execute a command as the server console.
| Parameter | Description |
|---|---|
command | the command string to execute |
fun ban(player: ServerPlayer)Ban a player by adding them to the server ban list and disconnecting them.
| Parameter | Description |
|---|---|
player | the ServerPlayer to ban |
fun banIp(ip: String)Ban an IP address and disconnect matching players.
| Parameter | Description |
|---|---|
ip | IP address string to ban |
fun deop(player: ServerPlayer)De-op a player (remove operator status).
| Parameter | Description |
|---|---|
player | ServerPlayer to de-op |
fun op(player: ServerPlayer)Op a player (grant operator status).
| Parameter | Description |
|---|---|
player | ServerPlayer to op |
fun setDifficulty(difficulty: Difficulty, ignoreLock: Boolean = true)Set server difficulty.
| Parameter | Description |
|---|---|
difficulty | new Difficulty |
ignoreLock | whether to ignore difficulty lock |
fun runFunction(id: Identifier, source: CommandSourceStack = requireServer().createCommandSourceStack())Run a function (data pack function) with an optional command source.
| Parameter | Description |
|---|---|
id | function identifier |
source | command source to use (defaults to server) |
fun setGameMode(player: ServerPlayer, gameMode: GameType)Set a player's game mode.
| Parameter | Description |
|---|---|
player | target ServerPlayer |
gameMode | target GameType |
fun <T : Any> setGameRule(key: GameRule<T>, value: T)Set a game rule value on the server overworld.
| Parameter | Description |
|---|---|
key | GameRule key |
value | value to set |
fun kick(player: Player, reason: Component = Component.translatable("multiplayer.disconnect.kicked"))Kick a player with an optional reason component.
| Parameter | Description |
|---|---|
player | target Player (ServerPlayer required to disconnect) |
reason | disconnect reason component |