From 5bf158c1d44eeec272e6113382080e751fe82f47 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:59:46 -0500 Subject: [PATCH] Fix negative playtime stat breaking /baltop (#6074) Unclear how this happens, possibly a division error? Fixes #6043 --- .../com/earth2me/essentials/commands/Commandbalancetop.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalancetop.java index 6ded4a197aa..baba65c5722 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalancetop.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandbalancetop.java @@ -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++;