Fix Soulbound with single-use option

Problem fixed: Items with the soulbound enchantment are removed after the second death
This commit is contained in:
Kapitowa 2023-06-24 23:53:34 +03:00
parent ecb9b4e96d
commit f725d5beda

View File

@ -131,7 +131,9 @@ class EnchantmentSoulbound(
ignoreCancelled = true
)
fun preventDroppingSoulboundItems(event: PlayerDeathEvent) {
event.drops.removeIf { it.fast().persistentDataContainer.has(soulboundKey, PersistentDataType.INTEGER) }
event.drops.removeIf { it.fast().persistentDataContainer.has(soulboundKey, PersistentDataType.INTEGER)
&& it.itemMeta.hasEnchant(enchant)
}
}
}
}