From f725d5beda7c44f3e3ebfcc9ddda5b55e07d916f Mon Sep 17 00:00:00 2001 From: Kapitowa Date: Sat, 24 Jun 2023 23:53:34 +0300 Subject: [PATCH] Fix Soulbound with single-use option Problem fixed: Items with the soulbound enchantment are removed after the second death --- .../willfp/ecoenchants/enchants/impl/EnchantmentSoulbound.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentSoulbound.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentSoulbound.kt index f4d5cc8f..33576b0c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentSoulbound.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentSoulbound.kt @@ -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) + } } } }