All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.chestmc.common.extensions.UniqueIdentifiers.kt Maven / Gradle / Ivy

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