From 55466d561ce8f64ae0fb5629b7a3d013d65bb76e Mon Sep 17 00:00:00 2001 From: mdxd44 Date: Fri, 1 Apr 2022 17:35:55 +0900 Subject: Fix IllegalArgumentException. --- src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java | 5 +++-- 1 file 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(); -- cgit