fix: anvil event resets result -> collides with other plugins

This commit is contained in:
Jan Komínek 2024-07-24 22:29:37 +02:00 committed by GitHub
parent 199bd8e621
commit a4857ed028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}