diff options
author | nea <nea@nea.moe> | 2023-09-29 22:44:13 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-09-29 22:44:13 +0200 |
commit | f89135db7e500571231721ac8d5b0ffff63469df (patch) | |
tree | 50d9f6ed963468194dcbaced0e508e120240b4f0 /src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt | |
parent | 7a71e77b4cc79331b135aa95b4b8c9dbdf9e76ef (diff) | |
download | firmament-f89135db7e500571231721ac8d5b0ffff63469df.tar.gz firmament-f89135db7e500571231721ac8d5b0ffff63469df.tar.bz2 firmament-f89135db7e500571231721ac8d5b0ffff63469df.zip |
Add UUID Locking (per unique item locking that allows movement)
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt b/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt index fe2b4e5..a071107 100644 --- a/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt +++ b/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt @@ -5,11 +5,12 @@ */ @file:UseSerializers(DashlessUUIDSerializer::class) + package moe.nea.firmament.util import io.github.moulberry.repo.data.NEUItem import io.github.moulberry.repo.data.Rarity -import java.util.UUID +import java.util.* import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import kotlinx.serialization.decodeFromString @@ -73,6 +74,12 @@ private val jsonparser = Json { ignoreUnknownKeys = true } val ItemStack.extraAttributes: NbtCompound get() = getOrCreateSubNbt("ExtraAttributes") +val ItemStack.skyblockUUIDString: String? + get() = extraAttributes.getString("uuid")?.takeIf { it.isNotBlank() } + +val ItemStack.skyblockUUID: UUID? + get() = skyblockUUIDString?.let { UUID.fromString(it) } + val ItemStack.petData: HypixelPetInfo? get() { val jsonString = extraAttributes.getString("petInfo") |