diff --git a/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/fast/NMSFastItemStack.kt b/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/fast/NMSFastItemStack.kt index 0476ffe38..4e556fa6c 100644 --- a/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/fast/NMSFastItemStack.kt +++ b/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/fast/NMSFastItemStack.kt @@ -9,7 +9,6 @@ import org.bukkit.craftbukkit.v1_16_R3.util.CraftMagicNumbers import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey import org.bukkit.enchantments.Enchantment import org.bukkit.inventory.ItemFlag -import java.lang.reflect.Field import kotlin.experimental.and class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemStack( @@ -145,11 +144,11 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS handle.orCreateTag.setInt("HideFlags", value) override fun getRepairCost(): Int { - return handle.repairCost; + return handle.repairCost } override fun setRepairCost(cost: Int) { - handle.repairCost = cost; + handle.repairCost = cost } private fun apply() { @@ -157,28 +156,4 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS bukkit.itemMeta = CraftItemStack.asCraftMirror(handle).itemMeta } } - - companion object { - private var field: Field - - init { - lateinit var temp: Field - try { - val handleField = CraftItemStack::class.java.getDeclaredField("handle") - handleField.isAccessible = true - temp = handleField - } catch (e: ReflectiveOperationException) { - e.printStackTrace() - } - field = temp - } - - fun getNMSStack(itemStack: org.bukkit.inventory.ItemStack): ItemStack? { - return if (itemStack !is CraftItemStack) { - CraftItemStack.asNMSCopy(itemStack) - } else { - field.get(itemStack) as ItemStack - } - } - } } \ No newline at end of file diff --git a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/fast/NMSFastItemStack.kt b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/fast/NMSFastItemStack.kt index 107fa3559..1754fb6ea 100644 --- a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/fast/NMSFastItemStack.kt +++ b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/fast/NMSFastItemStack.kt @@ -164,11 +164,11 @@ class NMSFastItemStack(itemStack: org.bukkit.inventory.ItemStack) : EcoFastItemS handle.orCreateTag.putInt("HideFlags", value) override fun getRepairCost(): Int { - return handle.baseRepairCost; + return handle.baseRepairCost } override fun setRepairCost(cost: Int) { - handle.setRepairCost(cost); + handle.setRepairCost(cost) } private fun apply() {