@@ -50,19 +50,33 @@ public JoinManagement(FastLoginCore<P, C, ?> core, AuthPlugin<P> authHook, Bedro
5050
5151 public void onLogin (String username , S source ) {
5252 core .getPlugin ().getLog ().info ("Handling player {}" , username );
53- StoredProfile profile = core .getStorage ().loadProfile (username );
54- if (profile == null ) {
55- return ;
56- }
5753
5854 //check if the player is connecting through Bedrock Edition
5955 if (bedrockService != null && bedrockService .isBedrockConnection (username )) {
60- //perform Bedrock specific checks and skip Java checks, if they are not needed
56+ //perform Bedrock specific checks
6157 if (bedrockService .performChecks (username , source )) {
58+ //skip Java checks, since they are not needed
6259 return ;
6360 }
6461 }
6562
63+ StoredProfile profile = core .getStorage ().loadProfile (username );
64+
65+ //can't be a premium Java player, if it's not saved in the database
66+ if (profile == null ) {
67+ return ;
68+ }
69+
70+ if (!profile .isFloodgateMigrated ()) {
71+ profile .setFloodgate (FloodgateState .FALSE );
72+ core .getPlugin ().getLog ().info (
73+ "Player {} will be migrated to the v2 database schema as a JAVA user" , username );
74+ } else if (profile .getFloodgate () == FloodgateState .TRUE ) {
75+ core .getPlugin ().getLog ().info ("Player {} is already stored by FastLogin as a Bedrock Edition player" ,
76+ username );
77+ return ;
78+ }
79+
6680 callFastLoginPreLoginEvent (username , source , profile );
6781
6882 Configuration config = core .getConfig ();
@@ -140,6 +154,12 @@ private boolean checkNameChange(S source, String username, Profile profile) {
140154 if (core .getConfig ().get ("nameChangeCheck" , false )) {
141155 StoredProfile storedProfile = core .getStorage ().loadProfile (profile .getId ());
142156 if (storedProfile != null ) {
157+ if (storedProfile .getFloodgate () == FloodgateState .TRUE ) {
158+ core .getPlugin ().getLog ()
159+ .info ("Player {} is already stored by FastLogin as a Bedrock Edition player." , username );
160+ return false ;
161+ }
162+
143163 //uuid exists in the database
144164 core .getPlugin ().getLog ().info ("GameProfile {} changed it's username" , profile );
145165
0 commit comments