better order for paper remove lore

This commit is contained in:
alexcrea 2025-03-22 19:24:40 +01:00
parent f02ac69928
commit a08fb3ac75
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F

View file

@ -192,17 +192,24 @@ object AnvilLoreEditUtil {
val line = if (removeEnd) lore.removeAt(lore.size - 1) val line = if (removeEnd) lore.removeAt(lore.size - 1)
else lore.removeAt(0) else lore.removeAt(0)
meta.lore = if (lore.isEmpty()) null else lore meta.lore = null
result.itemMeta = meta result.itemMeta = meta
// Update lore but make sure custom lore is put last
DependencyManager.updateLore(result)
val finalLore = ArrayList<String>()
finalLore.addAll(meta.lore!!)
finalLore.addAll(lore)
meta.lore = lore
if (result == first) return null
// Get color cost to uncolor this line // Get color cost to uncolor this line
val tempList = ArrayList<String>(1) val tempList = ArrayList<String>(1)
tempList.add(line) tempList.add(line)
val uncolorCost = uncolorLines(player, tempList, LoreEditType.REMOVE_PAPER) val uncolorCost = uncolorLines(player, tempList, LoreEditType.REMOVE_PAPER)
DependencyManager.updateLore(result)
if (result == first) return null
// Handle other xp // Handle other xp
xpCost.addAndGet(uncolorCost) xpCost.addAndGet(uncolorCost)
xpCost.addAndGet(baseEditLoreXpCost(first, result, LoreEditType.REMOVE_PAPER)) xpCost.addAndGet(baseEditLoreXpCost(first, result, LoreEditType.REMOVE_PAPER))