From 5eb8cd6d81fd1240c795997355f1df734f60ec61 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 23 Jun 2024 15:42:36 +0100 Subject: [PATCH] Fixed anvils --- .../kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 b80881e1..21f64497 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 @@ -2,6 +2,7 @@ package com.willfp.ecoenchants.mechanics import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.fast.fast +import com.willfp.eco.core.items.toSNBT import com.willfp.eco.core.proxy.ProxyConstants import com.willfp.eco.util.StringUtils import com.willfp.ecoenchants.enchant.EcoEnchants @@ -39,7 +40,6 @@ interface OpenInventoryProxy { fun getOpenInventory(player: Player): Any } -@Suppress("DEPRECATION") class AnvilSupport( private val plugin: EcoPlugin ) : Listener { @@ -237,7 +237,7 @@ class AnvilSupport( val rightDurability = maxDamage - rightMeta.damage val damage = maxDamage - max(maxDamage, leftDurability + rightDurability) - leftMeta.damage = damage + leftMeta.damage = damage.coerceAtLeast(0) // Prevent negative damage } if (leftMeta is EnchantmentStorageMeta) {