aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkforbro <kforbro@gmail.com>2022-07-19 01:39:09 +0300
committermdxd44 <ogurec332@mail.ru>2022-07-23 00:45:49 +0900
commitfa0c8b27b0d3bcafd3b7893b7730aa69849965aa (patch)
tree27fbd144acf85e1579616d6b1ccb0a62716e3357
parentb0b208b02f629eaaeabc6a380349a64adb642d45 (diff)
downloadLimboAuth-fa0c8b27b0d3bcafd3b7893b7730aa69849965aa.tar.gz
LimboAuth-fa0c8b27b0d3bcafd3b7893b7730aa69849965aa.tar.bz2
LimboAuth-fa0c8b27b0d3bcafd3b7893b7730aa69849965aa.zip
Hint in WRONG_NICKNAME_CASE_KICK. (#44)
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java2
-rw-r--r--src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java
index a777f5d..8a34d3b 100644
--- a/src/main/java/net/elytrium/limboauth/Settings.java
+++ b/src/main/java/net/elytrium/limboauth/Settings.java
@@ -230,7 +230,7 @@ public class Settings extends YamlConfig {
@Comment("6 hours by default in ip-limit-valid-time")
public String IP_LIMIT_KICK = "{PRFX}{NL}{NL}&cYour IP has reached max registered accounts. If this is an error, restart your router, or wait about 6 hours.";
- public String WRONG_NICKNAME_CASE_KICK = "{PRFX}{NL}&cThe case of your nickname is wrong. Nickname is CaSe SeNsItIvE.";
+ public String WRONG_NICKNAME_CASE_KICK = "{PRFX}{NL}&cYou should join using username &6{0}&c, not &6{1}&c.";
public String BOSSBAR = "{PRFX} You have &6{0} &fseconds left to log in.";
public String TIMES_UP = "{PRFX}{NL}&cAuthorization time is up.";
diff --git a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
index de50281..6f4b27e 100644
--- a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
+++ b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
@@ -60,7 +60,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
private static BossBar.Overlay bossbarOverlay;
private static Component ipLimitKick;
private static Component databaseErrorKick;
- private static Component wrongNicknameCaseKick;
+ private static String wrongNicknameCaseKick;
private static Component timesUp;
private static Component registerSuccessful;
@Nullable
@@ -122,6 +122,8 @@ public class AuthSessionHandler implements LimboSessionHandler {
this.player.disableFalling();
+ Serializer serializer = LimboAuth.getSerializer();
+
if (this.playerInfo == null) {
try {
List<RegisteredPlayer> alreadyRegistered = this.playerDao.queryForEq("IP", this.ip);
@@ -149,13 +151,14 @@ public class AuthSessionHandler implements LimboSessionHandler {
}
} else {
if (!this.proxyPlayer.getUsername().equals(this.playerInfo.getNickname())) {
- this.proxyPlayer.disconnect(wrongNicknameCaseKick);
+ this.proxyPlayer.disconnect(serializer.deserialize(
+ MessageFormat.format(wrongNicknameCaseKick, this.playerInfo.getNickname(), this.proxyPlayer.getUsername()))
+ );
return;
}
}
boolean bossBarEnabled = Settings.IMP.MAIN.ENABLE_BOSSBAR;
- Serializer serializer = LimboAuth.getSerializer();
int authTime = Settings.IMP.MAIN.AUTH_TIME;
float multiplier = 1000.0F / authTime;
this.authMainTask = this.player.getScheduledExecutor().scheduleWithFixedDelay(() -> {
@@ -346,7 +349,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
bossbarOverlay = BossBar.Overlay.valueOf(Settings.IMP.MAIN.BOSSBAR_OVERLAY.toUpperCase(Locale.ROOT));
ipLimitKick = serializer.deserialize(Settings.IMP.MAIN.STRINGS.IP_LIMIT_KICK);
databaseErrorKick = serializer.deserialize(Settings.IMP.MAIN.STRINGS.DATABASE_ERROR_KICK);
- wrongNicknameCaseKick = serializer.deserialize(Settings.IMP.MAIN.STRINGS.WRONG_NICKNAME_CASE_KICK);
+ wrongNicknameCaseKick = Settings.IMP.MAIN.STRINGS.WRONG_NICKNAME_CASE_KICK;
timesUp = serializer.deserialize(Settings.IMP.MAIN.STRINGS.TIMES_UP);
registerSuccessful = serializer.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_SUCCESSFUL);
if (Settings.IMP.MAIN.STRINGS.REGISTER_SUCCESSFUL_TITLE.isEmpty() && Settings.IMP.MAIN.STRINGS.REGISTER_SUCCESSFUL_SUBTITLE.isEmpty()) {