io.github.ayfri.kore.entities.Player.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oop Show documentation
Show all versions of oop Show documentation
An OOP form of Kore, experimental and not complete.
The newest version!
package io.github.ayfri.kore.entities
import io.github.ayfri.kore.arguments.selector.SelectorArguments
import io.github.ayfri.kore.generated.EntityTypes
class Player(name: String) : Entity() {
init {
selector.name = name
}
var name: String
get() = selector.name ?: throw IllegalStateException("Player name is null")
set(value) {
selector.name = value
}
override val type = EntityTypes.PLAYER
}
fun player(name: String, nbtData: SelectorArguments.() -> Unit = {}) = Player(name).apply {
selector.nbtData()
}