aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-01-25 15:43:56 +0300
committerPetr Ilin <hevav@hevav.dev>2022-01-25 15:43:56 +0300
commitd9e7e89acc444e8a991ff00dc2a13ea03ed6ed20 (patch)
treecfa1b5db81102efaf2fad16665f7c8183944dd40 /src/main
parent4400c83b9025ca24e6d8ac36b67e0fe8c336f6be (diff)
downloadLimboAuth-d9e7e89acc444e8a991ff00dc2a13ea03ed6ed20.tar.gz
LimboAuth-d9e7e89acc444e8a991ff00dc2a13ea03ed6ed20.tar.bz2
LimboAuth-d9e7e89acc444e8a991ff00dc2a13ea03ed6ed20.zip
Ability to set the prefix to offline/online players nickname
1.0.4-SNAPSHOT
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java4
-rw-r--r--src/main/java/net/elytrium/limboauth/listener/AuthListener.java12
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()
+ ));
+ }
}
}