From 0da40cab00af481388f087a698143a1226ee8d3c Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 23 Jun 2024 16:13:57 +0100 Subject: [PATCH] Improved reload messages and fixed anvil exceptions --- .../kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt | 4 +++- eco-core/core-plugin/src/main/resources/lang.yml | 4 ++-- 2 files changed, 5 insertions(+), 3 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 21f64497..f76a8327 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 @@ -194,7 +194,9 @@ class AnvilSupport( if (toDeduct <= 0) { return FAIL } else { - leftMeta.damage -= toDeduct * perUnit + val newDamage = leftMeta.damage - toDeduct * perUnit + leftMeta.damage = newDamage.coerceAtLeast(0) // Prevent negative damage + right.amount -= toDeduct } } else { diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index 44a17405..47fec2f9 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -4,8 +4,8 @@ messages: not-player: "&cThis command must be run by a player" invalid-command: "&cUnknown subcommand!" reloaded: "Reloaded!" - reloaded-1203: "Reloaded! You might need to restart your server if you have removed enchantments." - reloaded-121: "Reloaded! Relog if you added enchantments or you will get kicked. Removing enchantments may require a server restart." + reloaded-1203: "Reloaded! &cYou may need to restart your server for some changes to take effect." + reloaded-121: "Reloaded! &cRelog if you added enchantments or you will get kicked. You may need to restart your server for some changes to take effect." invalid-player: "&cInvalid Player!" requires-player: "&cRequires a Player!" enabled-descriptions: "&fYou have successfully &aenabled &fenchantment descriptions!"