Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/net/elytrium/limboauth/LimboAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ public boolean needAuth(Player player) {
}

public void authPlayer(Player player) {
boolean isFloodgate = !Settings.IMP.MAIN.FLOODGATE_NEED_AUTH && this.floodgateApi.isFloodgatePlayer(player.getUniqueId());
boolean isFloodgatePlayer = this.floodgateApi != null && this.floodgateApi.isFloodgatePlayer(player.getUniqueId());
boolean isFloodgate = !Settings.IMP.MAIN.FLOODGATE_NEED_AUTH && isFloodgatePlayer;
if (!isFloodgate && this.isForcedPreviously(player.getUsername()) && this.isPremium(player.getUsername())) {
player.disconnect(this.reconnectKick);
return;
Expand All @@ -569,7 +570,7 @@ public void authPlayer(Player player) {
}

String nickname = player.getUsername();
if (!this.nicknameValidationPattern.matcher((isFloodgate) ? nickname.substring(this.floodgateApi.getPrefixLength()) : nickname).matches()) {
if (!this.nicknameValidationPattern.matcher((isFloodgatePlayer) ? nickname.substring(this.floodgateApi.getPrefixLength()) : nickname).matches()) {
player.disconnect(this.nicknameInvalidKick);
return;
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/elytrium/limboauth/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ public static class MAIN {
public boolean CHANGE_PASSWORD_NEED_OLD_PASSWORD = true;
@Comment("Used in unregister and premium commands.")
public String CONFIRM_KEYWORD = "confirm";
@Comment("This prefix will be added to offline mode players nickname")
@Comment({
"This prefix will be added to offline mode players nickname",
"Geyser/Floodgate (Bedrock) players are excluded, since their names already contain the Floodgate prefix"
})
public String OFFLINE_MODE_PREFIX = "";
@Comment("This prefix will be added to online mode players nickname")
public String ONLINE_MODE_PREFIX = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ public void onLoginLimboRegister(LoginLimboRegisterEvent event) {

@Subscribe(order = PostOrder.FIRST)
public void onGameProfileRequest(GameProfileRequestEvent event) {
if (Settings.IMP.MAIN.SAVE_UUID && (this.floodgateApi == null || !this.floodgateApi.isFloodgatePlayer(event.getOriginalProfile().getId()))) {
boolean isFloodgatePlayer = this.floodgateApi != null && this.floodgateApi.isFloodgatePlayer(event.getOriginalProfile().getId());

if (Settings.IMP.MAIN.SAVE_UUID && !isFloodgatePlayer) {
RegisteredPlayer registeredPlayer = AuthSessionHandler.fetchInfo(this.playerDao, event.getOriginalProfile().getId());

if (registeredPlayer != null && !registeredPlayer.getUuid().isEmpty()) {
Expand Down Expand Up @@ -218,11 +220,11 @@ public void onGameProfileRequest(GameProfileRequestEvent event) {
}
}

if (Settings.IMP.MAIN.FORCE_OFFLINE_UUID) {
if (Settings.IMP.MAIN.FORCE_OFFLINE_UUID && !isFloodgatePlayer) {
event.setGameProfile(event.getOriginalProfile().withId(UuidUtils.generateOfflinePlayerUuid(event.getUsername())));
}

if (!event.isOnlineMode() && !Settings.IMP.MAIN.OFFLINE_MODE_PREFIX.isEmpty()) {
if (!event.isOnlineMode() && !isFloodgatePlayer && !Settings.IMP.MAIN.OFFLINE_MODE_PREFIX.isEmpty()) {
event.setGameProfile(event.getOriginalProfile().withName(Settings.IMP.MAIN.OFFLINE_MODE_PREFIX + event.getUsername()));
}

Expand Down