diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt index f76a8327..5eab376c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt @@ -78,9 +78,6 @@ class AnvilSupport( val old = left?.clone() val right = event.inventory.getItem(1)?.clone() - event.result = null - event.inventory.setItem(2, null) - val result = doMerge( left, right, @@ -88,6 +85,13 @@ class AnvilSupport( player ) + if (result == FAIL) { + return@run + } + + event.result = null + event.inventory.setItem(2, null) + val price = result.xp ?: 0 val outItem = result.result ?: ItemStack(Material.AIR) @@ -95,10 +99,6 @@ class AnvilSupport( val oldLeft = event.inventory.getItem(0) - if (result == FAIL) { - return@run - } - if (oldLeft == null || oldLeft.type != outItem.type) { return@run }