net.chestmc.common.extensions.UniqueIdentifiers.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chest-server Show documentation
Show all versions of chest-server Show documentation
A spigot fork to kotlin structure and news.
The newest version!
package net.chestmc.common.extensions
import org.bukkit.Bukkit
import org.bukkit.OfflinePlayer
import org.bukkit.World
import org.bukkit.entity.Player
import java.util.*
/**
* Returns a random [UUID].
*/
fun randomUUID(): UUID = UUID.randomUUID()
/**
* Parses this string as a UUID
*/
fun String.toUUID(): UUID = UUID.fromString(this)
/**
* Parses this UUID to a [Player].
*/
fun UUID.toPlayer(): Player = Bukkit.getPlayer(this)
/**
* Parses this UUID to a [OfflinePlayer].
*/
fun UUID.toOfflinePlayer(): OfflinePlayer = Bukkit.getOfflinePlayer(this)
/**
* Parses this UUID to a [World].
*/
fun UUID.toWorld(): World = Bukkit.getWorld(this)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy