From a08fb3ac75b7afbb7e326d2163c382a4efeb14f6 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 22 Mar 2025 19:24:40 +0100 Subject: [PATCH] better order for paper remove lore --- .../alexcrea/cuanvil/util/AnvilLoreEditUtil.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilLoreEditUtil.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilLoreEditUtil.kt index e3b052a..25256a1 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilLoreEditUtil.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilLoreEditUtil.kt @@ -192,17 +192,24 @@ object AnvilLoreEditUtil { val line = if (removeEnd) lore.removeAt(lore.size - 1) else lore.removeAt(0) - meta.lore = if (lore.isEmpty()) null else lore + meta.lore = null result.itemMeta = meta + // Update lore but make sure custom lore is put last + DependencyManager.updateLore(result) + + val finalLore = ArrayList() + finalLore.addAll(meta.lore!!) + finalLore.addAll(lore) + + meta.lore = lore + if (result == first) return null + // Get color cost to uncolor this line val tempList = ArrayList(1) tempList.add(line) val uncolorCost = uncolorLines(player, tempList, LoreEditType.REMOVE_PAPER) - DependencyManager.updateLore(result) - if (result == first) return null - // Handle other xp xpCost.addAndGet(uncolorCost) xpCost.addAndGet(baseEditLoreXpCost(first, result, LoreEditType.REMOVE_PAPER))