diff options
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | src/main/java/net/elytrium/limboauth/Settings.java | 4 | ||||
-rw-r--r-- | src/main/java/net/elytrium/limboauth/listener/AuthListener.java | 12 |
3 files changed, 17 insertions, 1 deletions
diff --git a/build.gradle b/build.gradle index 990b70c..c20cb3a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { } setGroup("net.elytrium") -setVersion("1.0.3") +setVersion("1.0.4-SNAPSHOT") compileJava { getOptions().setEncoding("UTF-8") diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index bbae307..7903db4 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -62,6 +62,10 @@ public class Settings extends Config { public boolean TOTP_NEED_PASSWORD = true; public boolean REGISTER_NEED_REPEAT_PASSWORD = true; public boolean CHANGE_PASSWORD_NEED_OLD_PASSWORD = true; + @Comment("This prefix will be added to offline mode players nickname") + public String OFFLINE_MODE_PREFIX = ""; + @Comment("This prefix will be added to online mode players nickname") + public String ONLINE_MODE_PREFIX = ""; @Comment({ "If you want to migrate your database from another plugin, which is not using BCrypt.", "You can set an old hash algorithm to migrate from. Currently, only AUTHME is supported yet." diff --git a/src/main/java/net/elytrium/limboauth/listener/AuthListener.java b/src/main/java/net/elytrium/limboauth/listener/AuthListener.java index 70dca80..59ab50d 100644 --- a/src/main/java/net/elytrium/limboauth/listener/AuthListener.java +++ b/src/main/java/net/elytrium/limboauth/listener/AuthListener.java @@ -124,5 +124,17 @@ public class AuthListener { if (Settings.IMP.MAIN.FORCE_OFFLINE_UUID) { event.setGameProfile(event.getOriginalProfile().withId(UuidUtils.generateOfflinePlayerUuid(event.getUsername()))); } + + if (!event.isOnlineMode() && !Settings.IMP.MAIN.OFFLINE_MODE_PREFIX.isEmpty()) { + event.setGameProfile(event.getOriginalProfile().withName( + Settings.IMP.MAIN.OFFLINE_MODE_PREFIX + event.getUsername() + )); + } + + if (event.isOnlineMode() && !Settings.IMP.MAIN.ONLINE_MODE_PREFIX.isEmpty()) { + event.setGameProfile(event.getOriginalProfile().withName( + Settings.IMP.MAIN.ONLINE_MODE_PREFIX + event.getUsername() + )); + } } } |