Skip to content

ServerClosure

Wittawat Manha edited this page Sep 8, 2020 · 1 revision

Server Closure

example

import com.wireless4024.mc.bukcore.utils.*

server {
    // `this` is same as `Bukkit.getServer()`

    defaultGameMode = GameMode.CREATIVE
    // same as 
    // Bukkit.getServer().defaultGameMode = GameMode.CREATIVE
    val playerName = "playerabc"

    // you can also return a value from a block
    val level:Int? = player(playerName){
        // this block will execute if player is found
        kill() // kill him if found
        level // return player level from this block
    }
    
    // if you want to apply something to all player in server
    player {
        // give 10 level to all player in server
        giveExpLevels(10)
    }
}

Clone this wiki locally