From cffcb67b2d1ac4b1b10febf81704ba3eb28b66ad Mon Sep 17 00:00:00 2001 From: Petr Ilin Date: Tue, 17 Jan 2023 07:39:48 +0300 Subject: [PATCH] 1.0.8: allow-premium-names-registration option --- VERSION | 2 +- build.gradle | 2 +- src/main/java/net/elytrium/limboauth/socialaddon/Addon.java | 5 +++++ .../java/net/elytrium/limboauth/socialaddon/Settings.java | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 238d6e8..b0f3d96 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.7 +1.0.8 diff --git a/build.gradle b/build.gradle index 5060dc6..ffba5f7 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { } setGroup("net.elytrium") -setVersion("1.0.7") +setVersion("1.0.8") compileJava { getOptions().setEncoding("UTF-8") diff --git a/src/main/java/net/elytrium/limboauth/socialaddon/Addon.java b/src/main/java/net/elytrium/limboauth/socialaddon/Addon.java index 0bfd204..0f16928 100644 --- a/src/main/java/net/elytrium/limboauth/socialaddon/Addon.java +++ b/src/main/java/net/elytrium/limboauth/socialaddon/Addon.java @@ -222,6 +222,11 @@ private void load() { return; } + if (!Settings.IMP.MAIN.ALLOW_PREMIUM_NAMES_REGISTRATION && this.plugin.isPremium(lowercaseNickname)) { + this.socialManager.broadcastMessage(dbField, id, Settings.IMP.MAIN.STRINGS.REGISTER_PREMIUM_NICKNAME); + return; + } + String newPassword = Long.toHexString(Double.doubleToLongBits(Math.random())); RegisteredPlayer player = new RegisteredPlayer(account, "", "").setPassword(newPassword); diff --git a/src/main/java/net/elytrium/limboauth/socialaddon/Settings.java b/src/main/java/net/elytrium/limboauth/socialaddon/Settings.java index e7b8571..444714d 100644 --- a/src/main/java/net/elytrium/limboauth/socialaddon/Settings.java +++ b/src/main/java/net/elytrium/limboauth/socialaddon/Settings.java @@ -59,6 +59,9 @@ public static class MAIN { public String FORCE_UNLINK_MAIN_CMD = "forcesocialunlink"; public List FORCE_UNLINK_ALIAS_CMD = List.of("forceunlink"); + @Comment("Should we allow registration with premium usernames using social-register-cmds") + public boolean ALLOW_PREMIUM_NAMES_REGISTRATION = false; + public boolean ENABLE_NOTIFY = true; @Comment("Will the unlink button unregister all socials at once?") @@ -213,6 +216,7 @@ public static class STRINGS { public String LINK_CODE = "🔑 Enter '/addsocial {CODE}' in game to complete account linking"; public String REGISTER_INCORRECT_NICKNAME = "There is no account with this nickname"; public String REGISTER_TAKEN_NICKNAME = "This nickname is already taken"; + public String REGISTER_PREMIUM_NICKNAME = "This nickname belongs to a premium player"; @Placeholders({"{PASSWORD}"}) public String REGISTER_SUCCESS = "✅ Account was successfully registered{NL}Your password: {PASSWORD}{NL}Use '!keyboard' to show keyboard";