From a4857ed028d1f097f8a81c80dda74264ed3dd8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kom=C3=ADnek?= <74021016+H7KZ@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:29:37 +0200 Subject: [PATCH] fix: anvil event resets result -> collides with other plugins --- .../willfp/ecoenchants/mechanics/AnvilSupport.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 }