diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java index f0c27651..4ca3b694 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java @@ -80,6 +80,38 @@ public abstract class FloodgateManagement
authPlugin = core.getAuthPluginHook(); try { @@ -119,13 +151,17 @@ public abstract class FloodgateManagement
{ public void onLogin(String username, S source) { core.getPlugin().getLog().info("Handling player {}", username); + + //check if the player is connecting through Bedrock Edition + if (bedrockService != null && bedrockService.isBedrockConnection(username)) { + //perform Bedrock specific checks + if (bedrockService.performChecks(username, source)) { + //skip Java checks, since they are not needed + return; + } + } + StoredProfile profile = core.getStorage().loadProfile(username); + + //can't be a premium Java player, if it's not saved in the database if (profile == null) { return; } - //check if the player is connecting through Bedrock Edition - if (bedrockService != null && bedrockService.isBedrockConnection(username)) { - //perform Bedrock specific checks and skip Java checks, if they are not needed - if (bedrockService.performChecks(username, source)) { - return; - } + if (!profile.isFloodgateMigrated()) { + profile.setFloodgate(FloodgateState.FALSE); + core.getPlugin().getLog().info( + "Player {} will be migrated to the v2 database schema as a JAVA user", username); + } else if (profile.getFloodgate() == FloodgateState.TRUE) { + core.getPlugin().getLog().info("Player {} is already stored by FastLogin as a Bedrock Edition player", + username); + return; } callFastLoginPreLoginEvent(username, source, profile); @@ -139,6 +153,12 @@ public abstract class JoinManagement
{ if (core.getConfig().get("nameChangeCheck", false)) { StoredProfile storedProfile = core.getStorage().loadProfile(profile.getId()); if (storedProfile != null) { + if (storedProfile.getFloodgate() == FloodgateState.TRUE) { + core.getPlugin().getLog() + .info("Player {} is already stored by FastLogin as a Bedrock Edition player.", username); + return false; + } + //uuid exists in the database core.getPlugin().getLog().info("GameProfile {} changed it's username", profile); diff --git a/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLStorage.java index f10a0796..ade10a40 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLStorage.java @@ -26,7 +26,6 @@ package com.github.games647.fastlogin.core.storage; import com.github.games647.craftapi.UUIDAdapter; -import com.github.games647.fastlogin.core.StoredProfile; import com.github.games647.fastlogin.core.shared.FloodgateState; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource;