From fa72dd4ce107190cda7bc56234fed650f20e3aa9 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 8 Dec 2024 00:42:01 +0100 Subject: feat: Add visitor trading detection --- src/main/kotlin/moe/nea/ledger/ItemUtil.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/moe/nea/ledger/ItemUtil.kt') diff --git a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt index cadcb66..4bbd4cd 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt @@ -9,7 +9,8 @@ fun ItemStack.getExtraAttributes(): NBTTagCompound { return nbt.getCompoundTag("ExtraAttributes") } -fun ItemStack.getInternalId(): ItemId? { +fun ItemStack?.getInternalId(): ItemId? { + if (this == null) return null val extraAttributes = getExtraAttributes() var id = extraAttributes.getString("id") id = id.takeIf { it.isNotBlank() } -- cgit