aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-08 00:42:01 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-08 00:42:01 +0100
commitfa72dd4ce107190cda7bc56234fed650f20e3aa9 (patch)
tree57a5fa0c224db5bb670e26813c958a768d6bdf90 /src/main/kotlin/moe/nea/ledger/ItemUtil.kt
parent0a2342c015b310172f933df765d8651013c26f16 (diff)
downloadLocalTransactionLedger-fa72dd4ce107190cda7bc56234fed650f20e3aa9.tar.gz
LocalTransactionLedger-fa72dd4ce107190cda7bc56234fed650f20e3aa9.tar.bz2
LocalTransactionLedger-fa72dd4ce107190cda7bc56234fed650f20e3aa9.zip
feat: Add visitor trading detection
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemUtil.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemUtil.kt3
1 files changed, 2 insertions, 1 deletions
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() }