Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception with monostable filter bossbars #1115

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
}