Fix afk kick bar timer not progressing
This commit is contained in:
parent
e9ed408489
commit
399ee1394b
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user