Fix afk kick bar timer not progressing

This commit is contained in:
Teriuihi 2023-06-23 00:22:16 +02:00
parent e9ed408489
commit 399ee1394b
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ public class AFKCheckTimer extends BukkitRunnable {
setPlayerAFK(afkPlayer, player); setPlayerAFK(afkPlayer, player);
} }
if (afkPlayer.isAFK()) { if (afkPlayer.isAFK()) {
afkPlayer.updateBossBarProgress((int) TimeUnit.MINUTES.toSeconds(afkPlayer.getAfkTimeMinutes())); afkPlayer.updateBossBarProgress(afkPlayer.getAfkTimeMinutes());
} }
runMessageTimerCheck(afkPlayer, uuid, standingTime); runMessageTimerCheck(afkPlayer, uuid, standingTime);
} }

View File

@ -123,9 +123,9 @@ public class AFKPlayer {
isWarned = true; isWarned = true;
} }
public void updateBossBarProgress(int totalAllowedSeconds) { public void updateBossBarProgress(int totalAllowedMinutes) {
double afkSeconds = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - getStandingTime()); double afkSeconds = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - getStandingTime());
double toggleSeconds = TimeUnit.MINUTES.toSeconds(totalAllowedSeconds); double toggleSeconds = TimeUnit.MINUTES.toSeconds(totalAllowedMinutes);
bossBar.setProgress(Math.min(afkSeconds / toggleSeconds, 1)); bossBar.setProgress(Math.min(afkSeconds / toggleSeconds, 1));
} }
} }