GameEntity.kt

Branches > main > 039d1df > files / src / main / kotlin / net / bowmap / stormbow / game / GameEntity.kt

package net.bowmap.stormbow.game

import java.util.UUID
import org.bukkit.Player

// An immutable reference to a mutable entity
// Can only call impure functions on this entity to get things from it
// And execute effects on it to do things to it

// Players also go under this category

/// An immutable game entity
interface Entity {
  val uuid: UUID
}

/// An immutable player
data class Player(override val uuid: UUID) : Entity

fun fromBukkitPlayer(p: org.bukkit.Player): Player =
  Player(uuid = p.uniqueId)