
walkmc.extensions.UUIDs.kt Maven / Gradle / Ivy
@file:Suppress("NOTHING_TO_INLINE")
package walkmc.extensions
import org.bukkit.*
import org.bukkit.entity.*
import walkmc.extensions.constants.*
import java.util.*
/**
* Returns a random [UUID].
*/
inline fun randomUUID(): UUID = UUID.randomUUID()
/**
* Parses this string as a UUID
*/
inline fun String.toUUID(): UUID = UUID.fromString(this)
/**
* Parses this UUID to a [Player].
*/
inline fun UUID.toPlayer(): Player = Bukkit.getPlayer(this)
/**
* Parses this UUID to a [OfflinePlayer].
*/
inline fun UUID.toOfflinePlayer(): OfflinePlayer = Bukkit.getOfflinePlayer(this)
/**
* Parses this UUID to a [World].
*/
inline fun UUID.toWorld(): World = Bukkit.getWorld(this)
/**
* Gets the repository file of this player.
*/
val UUID.playerRepository get() = newFile(RepositoryFolder, "$this.dat")
© 2015 - 2025 Weber Informatics LLC | Privacy Policy