From 6133419499e6e012d7969482b7e69fa3e22d6c15 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Fri, 2 Feb 2024 16:18:11 +0100 Subject: [PATCH] fix strange level price for book. --- src/main/kotlin/io/delilaheve/AnvilEventListener.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/delilaheve/AnvilEventListener.kt b/src/main/kotlin/io/delilaheve/AnvilEventListener.kt index d2ad72c..51a479c 100644 --- a/src/main/kotlin/io/delilaheve/AnvilEventListener.kt +++ b/src/main/kotlin/io/delilaheve/AnvilEventListener.kt @@ -57,11 +57,15 @@ class AnvilEventListener : Listener { resultItem.itemMeta = it } resultItem.setEnchantmentsUnsafe(newEnchants) + var repairCost: Int if (!first.isBook() && !second.isBook()) { + repairCost = first.repairCost + second.repairCost // we only need to be concerned with repair when neither item is a book resultItem.repairFrom(first, second) + }else{ + repairCost = resultItem.repairCost } - var repairCost = first.repairCost + second.repairCost + if (ConfigOptions.limitRepairCost) { repairCost = min(repairCost, ConfigOptions.limitRepairValue) }