aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormdxd44 <ogurec332@mail.ru>2022-05-20 04:27:47 +0900
committermdxd44 <ogurec332@mail.ru>2022-05-20 04:27:47 +0900
commit9e3e49723f5ce61de62ccc5beda178bdcd4087ac (patch)
treed29c39478c28d1b0be712821db9d3166ad96f969
parent320283639262b06d72ddd9d6d9cef2e6ac1b0fe4 (diff)
downloadLimboAuth-9e3e49723f5ce61de62ccc5beda178bdcd4087ac.tar.gz
LimboAuth-9e3e49723f5ce61de62ccc5beda178bdcd4087ac.tar.bz2
LimboAuth-9e3e49723f5ce61de62ccc5beda178bdcd4087ac.zip
Fixes.
-rw-r--r--src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
index 29c540c..c2a0234 100644
--- a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
+++ b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
@@ -156,15 +156,16 @@ public class AuthSessionHandler implements LimboSessionHandler {
boolean bossBarEnabled = Settings.IMP.MAIN.ENABLE_BOSSBAR;
Serializer serializer = LimboAuth.getSerializer();
int authTime = Settings.IMP.MAIN.AUTH_TIME;
- float multiplier = authTime / 1000.0F;
+ float multiplier = 1000.0F / authTime;
this.authMainTask = this.plugin.getServer().getScheduler().buildTask(this.plugin, () -> {
if (System.currentTimeMillis() - this.joinTime > authTime) {
this.proxyPlayer.disconnect(timesUp);
} else {
if (bossBarEnabled) {
- float secondsLeft = ((System.currentTimeMillis() - this.joinTime) - authTime) / 1000.0F;
+ float secondsLeft = (authTime - (System.currentTimeMillis() - this.joinTime)) / 1000.0F;
this.bossBar.name(serializer.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.BOSSBAR, (int) secondsLeft)));
- this.bossBar.progress((int) (secondsLeft * multiplier));
+ // It's possible, that the progress value can overcome 1, e.g. 1.0000001.
+ this.bossBar.progress(Math.min(1.0F, secondsLeft * multiplier));
}
}
}).repeat(1, TimeUnit.SECONDS).schedule();
@@ -359,7 +360,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
int loginAttempts = Settings.IMP.MAIN.LOGIN_ATTEMPTS;
loginWrongPassword = new Component[loginAttempts];
for (int i = 0; i < loginAttempts; ++i) {
- loginWrongPassword[i] = serializer.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN_WRONG_PASSWORD, i));
+ loginWrongPassword[i] = serializer.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN_WRONG_PASSWORD, i + 1));
}
loginWrongPasswordKick = serializer.deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_WRONG_PASSWORD_KICK);
totp = serializer.deserialize(Settings.IMP.MAIN.STRINGS.TOTP);
@@ -384,7 +385,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
}
login = new Component[loginAttempts];
for (int i = 0; i < loginAttempts; ++i) {
- login[i] = serializer.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN, i));
+ login[i] = serializer.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN, i + 1));
}
if (Settings.IMP.MAIN.STRINGS.LOGIN_TITLE.isEmpty() && Settings.IMP.MAIN.STRINGS.LOGIN_SUBTITLE.isEmpty()) {
loginTitle = null;