Skip to content

Commit

Permalink
Fix: Skill progress NumberFormatException (#3105)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
hannibal002 and hannibal002 authored Dec 25, 2024
1 parent c4750c0 commit 8347d2a
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,20 +463,28 @@ object SkillProgress {
}

if (config.showActionLeft.get() && percent != 100f) {
append(" - ")
val gain = skill.lastGain.formatDouble()
val actionLeft = (ceil(currentXpMax.toDouble() - currentXp) / gain).toLong().plus(1).addSeparators()
if (skill.lastGain != "" && !actionLeft.contains("-")) {
append("§6$actionLeft Left")
} else {
append("§6∞ Left")
}
append(" - " + addActionsLeft(skill, currentXpMax, currentXp))
}
},
),
)
}

private fun addActionsLeft(
skill: SkillAPI.SkillInfo,
currentXpMax: Long,
currentXp: Long,
): String {
if (skill.lastGain != "") {
val gain = skill.lastGain.formatDouble()
val actionLeft = (ceil(currentXpMax.toDouble() - currentXp) / gain).toLong().plus(1).addSeparators()
if (skill.lastGain != "" && !actionLeft.contains("-")) {
return "§6$actionLeft Left"
}
}
return "§6∞ Left"
}

private fun updateSkillInfo() {
val activeSkill = activeSkill ?: return
val xpInfo = skillXPInfoMap.getOrPut(activeSkill) { SkillAPI.SkillXPInfo() }
Expand Down

0 comments on commit 8347d2a

Please sign in to comment.