aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormdxd44 <ogurec332@mail.ru>2022-04-01 17:35:55 +0900
committermdxd44 <ogurec332@mail.ru>2022-04-01 17:35:55 +0900
commit55466d561ce8f64ae0fb5629b7a3d013d65bb76e (patch)
tree8691dca502eca06b391fac46799c5a8b546e0489
parent0b79ceba393e0b592fa12d0c1be98a5b403965f9 (diff)
downloadLimboAuth-55466d561ce8f64ae0fb5629b7a3d013d65bb76e.tar.gz
LimboAuth-55466d561ce8f64ae0fb5629b7a3d013d65bb76e.tar.bz2
LimboAuth-55466d561ce8f64ae0fb5629b7a3d013d65bb76e.zip
Fix IllegalArgumentException.
-rw-r--r--src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
index 13200d0..359f77b 100644
--- a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
+++ b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
@@ -102,8 +102,9 @@ public class AuthSessionHandler implements LimboSessionHandler {
}
if (bossBarEnabled) {
long timeSinceJoin = Settings.IMP.MAIN.AUTH_TIME - (System.currentTimeMillis() - AuthSessionHandler.this.joinTime);
- this.bossBar.name(this.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.BOSSBAR, (int) (timeSinceJoin / 1000))));
- this.bossBar.progress((timeSinceJoin * bossBarMultiplier) / 1000);
+ this.bossBar.name(this.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.BOSSBAR, (int) (timeSinceJoin / 1000F))));
+ // It is possible, that the progress value can overcome 1, e.g. 1.0000001.
+ this.bossBar.progress(Math.min((timeSinceJoin * bossBarMultiplier) / 1000F, 1F));
}
}).repeat(1, TimeUnit.SECONDS).schedule();