
walkmc.interfaces.Ownerable.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
package walkmc.interfaces
import org.bukkit.*
import org.bukkit.entity.*
import walkmc.extensions.*
import java.util.*
/**
* A ownerable interface, representing a object that can have a owner.
*/
interface Ownerable {
/**
* The owner identifier of this ownerable object.
*/
var ownerId: UUID
}
/**
* Returns the owner name of this ownerable object.
*/
val Ownerable.ownerName: String
get() = offlineOwner.name
/**
* Returns the owner as player of this ownerable object.
*/
var Ownerable.owner: Player
get() = ownerId.toPlayer()
set(value) {
ownerId = value.uuid
}
/**
* Returns the owner as offline player of this ownerable object.
*/
var Ownerable.offlineOwner: OfflinePlayer
get() = ownerId.toOfflinePlayer()
set(value) {
ownerId = value.uuid
}
/**
* Returns if the specified player is owner of this ownerable object instance.
*/
fun Ownerable.isOwner(player: OfflinePlayer): Boolean = ownerId == player.uuid
/**
* Returns if the specified UUID is owner of this ownerable object instance.
*/
fun Ownerable.isOwner(id: UUID): Boolean = ownerId == id
© 2015 - 2025 Weber Informatics LLC | Privacy Policy