Skip to content

Commit

Permalink
Fix boss bar progress error when max skill level
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Sep 21, 2024
1 parent 88f352e commit cb43666
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,18 @@ public void sendBossBar(Player player, Skill skill, double currentXp, double lev
float progressNew = (float) (currentXp / levelXp);
progressNew = Math.min(progressNew, 1.0f);
progressNew = Math.max(progressNew, 0.0f);
if (levelXp == 0) {
progressNew = 1.0f;
}
// If player does not have a boss bar in that skill
if (bossBar == null) {
// Calculate progress before gaining xp, for boss bar animation
float progressOld = (float) (Math.max(currentXp - xpGained, 0) / levelXp);
progressOld = Math.min(progressOld, 1.0f);
progressOld = Math.max(progressOld, 0.0f);
if (levelXp == 0) {
progressOld = 1.0f;
}
bossBar = handleNewBossBar(player, skill, progressOld, progressNew, text);
}
// Use existing one
Expand Down

0 comments on commit cb43666

Please sign in to comment.