diff options
author | mdxd44 <ogurec332@mail.ru> | 2022-04-01 17:35:55 +0900 |
---|---|---|
committer | mdxd44 <ogurec332@mail.ru> | 2022-04-01 17:35:55 +0900 |
commit | 55466d561ce8f64ae0fb5629b7a3d013d65bb76e (patch) | |
tree | 8691dca502eca06b391fac46799c5a8b546e0489 | |
parent | 0b79ceba393e0b592fa12d0c1be98a5b403965f9 (diff) | |
download | LimboAuth-55466d561ce8f64ae0fb5629b7a3d013d65bb76e.tar.gz LimboAuth-55466d561ce8f64ae0fb5629b7a3d013d65bb76e.tar.bz2 LimboAuth-55466d561ce8f64ae0fb5629b7a3d013d65bb76e.zip |
Fix IllegalArgumentException.
-rw-r--r-- | src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java | 5 |
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(); |