diff options
Diffstat (limited to 'src/main/java/net')
-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 |
2 files changed, 16 insertions, 0 deletions
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() + )); + } } } |