Skip to content

Commit

Permalink
Fix exception with monostable filter bossbars
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Herrera <[email protected]>
  • Loading branch information
Pablete1234 committed Jan 27, 2023
1 parent 601a492 commit e7898bf
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ public void tick(Match match, Tick tick) {
long oldSeconds = lastTick.until(end, ChronoUnit.SECONDS);
long newSeconds = now.until(end, ChronoUnit.SECONDS);

// Intentionally use old, as transitioning from 4s to 3.95s should show 4s
// Round up as going from 4s to 3.95s should show 4s
if (oldSeconds != newSeconds)
updateBossBar(filterable, Duration.ofSeconds(oldSeconds));
updateBossBar(filterable, Duration.ofSeconds(newSeconds + 1));
}
});

Expand Down Expand Up @@ -241,7 +241,7 @@ private Component getMessage(Duration remaining) {
}

private float progress(Duration remaining) {
return Math.min(1f, (float) remaining.toMillis() / duration.toMillis());
return Math.min(1f, (float) remaining.getSeconds() / duration.getSeconds());
}
}
}

0 comments on commit e7898bf

Please sign in to comment.