diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-08 00:42:01 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-08 00:42:01 +0100 |
commit | fa72dd4ce107190cda7bc56234fed650f20e3aa9 (patch) | |
tree | 57a5fa0c224db5bb670e26813c958a768d6bdf90 /src/main/kotlin/moe/nea/ledger/ItemUtil.kt | |
parent | 0a2342c015b310172f933df765d8651013c26f16 (diff) | |
download | LocalTransactionLedger-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.kt | 3 |
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() } |