Soulbound now uses a native paper API

This commit is contained in:
Auxilor 2023-10-22 14:43:03 +01:00
parent b86f030422
commit c0eadf6959

View File

@ -1,6 +1,7 @@
package com.willfp.ecoenchants.enchants.impl package com.willfp.ecoenchants.enchants.impl
import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.Prerequisite
import com.willfp.eco.core.data.keys.PersistentDataKey import com.willfp.eco.core.data.keys.PersistentDataKey
import com.willfp.eco.core.data.keys.PersistentDataKeyType import com.willfp.eco.core.data.keys.PersistentDataKeyType
import com.willfp.eco.core.data.profile import com.willfp.eco.core.data.profile
@ -80,6 +81,12 @@ class EnchantmentSoulbound(
event.drops.removeAll(items) event.drops.removeAll(items)
// Use native paper method
if (Prerequisite.HAS_PAPER.isMet) {
event.itemsToKeep += items
return
}
for (item in items) { for (item in items) {
item.fast().persistentDataContainer.set(soulboundKey, PersistentDataType.INTEGER, 1) item.fast().persistentDataContainer.set(soulboundKey, PersistentDataType.INTEGER, 1)