Skip to content

Commit

Permalink
Fix negative playtime stat breaking /baltop (#6074)
Browse files Browse the repository at this point in the history
Unclear how this happens, possibly a division error?

Fixes #6043
  • Loading branch information
JRoy authored Mar 1, 2025
1 parent 1531cf4 commit 5bf158c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ public void run() {
playtime = user.getBase().getStatistic(PLAY_ONE_TICK);
}
// Play time in seconds
final long playTimeSecs = playtime / 20;
final long playTimeSecs = Math.max(playtime / 20, 0);

// Checking if player meets the requirements of minimum balance and minimum playtime to be listed in baltop list
if ((ess.getSettings().showZeroBaltop() || balance.compareTo(BigDecimal.ZERO) > 0)
&& balance.compareTo(ess.getSettings().getBaltopMinBalance()) >= 0 &&
playTimeSecs > ess.getSettings().getBaltopMinPlaytime()) {
playTimeSecs >= ess.getSettings().getBaltopMinPlaytime()) {
newCache.getLines().add(AdventureUtil.miniToLegacy(tlLiteral("balanceTopLine", pos, entry.getValue().getDisplayName(), AdventureUtil.parsed(NumberUtil.displayCurrency(balance, ess)))));
}
pos++;
Expand Down

0 comments on commit 5bf158c

Please sign in to comment.