forked from TuxCoding/FastLogin
Invert if and document migration flow for better readability
This commit is contained in:
@ -82,7 +82,19 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
profile = core.getStorage().loadProfile(username);
|
profile = core.getStorage().loadProfile(username);
|
||||||
|
|
||||||
if (profile.isSaved()) {
|
if (profile.isSaved()) {
|
||||||
if (!profile.isFloodgateMigrated()) {
|
if (profile.isFloodgateMigrated()) {
|
||||||
|
if (profile.getFloodgate() == FloodgateState.TRUE && isLinked) {
|
||||||
|
core.getPlugin().getLog()
|
||||||
|
.info("Player {} is already stored by FastLogin as a non-linked Bedrock Edition player",
|
||||||
|
username);
|
||||||
|
return;
|
||||||
|
} else if (profile.getFloodgate() == FloodgateState.FALSE && isLinked) {
|
||||||
|
profile.setFloodgate(FloodgateState.LINKED);
|
||||||
|
core.getPlugin().getLog().info(
|
||||||
|
"Player {} will be changed from a Java player to a linked Floodgate player",
|
||||||
|
username);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (isLinked) {
|
if (isLinked) {
|
||||||
profile.setFloodgate(FloodgateState.LINKED);
|
profile.setFloodgate(FloodgateState.LINKED);
|
||||||
core.getPlugin().getLog().info(
|
core.getPlugin().getLog().info(
|
||||||
@ -93,16 +105,6 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
core.getPlugin().getLog().info(
|
core.getPlugin().getLog().info(
|
||||||
"Player {} will be migrated to the v2 database schema as a Floodgate user", username);
|
"Player {} will be migrated to the v2 database schema as a Floodgate user", username);
|
||||||
}
|
}
|
||||||
} else if (profile.getFloodgate() == FloodgateState.TRUE && isLinked) {
|
|
||||||
core.getPlugin().getLog()
|
|
||||||
.info("Player {} is already stored by FastLogin as a non-linked Bedrock Edition player",
|
|
||||||
username);
|
|
||||||
return;
|
|
||||||
} else if (profile.getFloodgate() == FloodgateState.FALSE && isLinked) {
|
|
||||||
profile.setFloodgate(FloodgateState.LINKED);
|
|
||||||
core.getPlugin().getLog().info(
|
|
||||||
"Player {} will be changed from a Java player to a linked Floodgate player",
|
|
||||||
username);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isLinked) {
|
if (isLinked) {
|
||||||
|
@ -52,9 +52,8 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
|
|||||||
|
|
||||||
//check if the player is connecting through Bedrock Edition
|
//check if the player is connecting through Bedrock Edition
|
||||||
if (bedrockService != null && bedrockService.isBedrockConnection(username)) {
|
if (bedrockService != null && bedrockService.isBedrockConnection(username)) {
|
||||||
//perform Bedrock specific checks
|
//perform Bedrock specific checks and skip Java checks if no longer needed
|
||||||
if (bedrockService.performChecks(username, source)) {
|
if (bedrockService.performChecks(username, source)) {
|
||||||
//skip Java checks, since they are not needed
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,14 +65,16 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.isFloodgateMigrated()) {
|
if (profile.isFloodgateMigrated()) {
|
||||||
|
if (profile.getFloodgate() == FloodgateState.TRUE) {
|
||||||
|
// migrated and enabled floodgate player, however the above bedrocks fails, so the current connection
|
||||||
|
// isn't premium
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
profile.setFloodgate(FloodgateState.FALSE);
|
profile.setFloodgate(FloodgateState.FALSE);
|
||||||
core.getPlugin().getLog().info(
|
core.getPlugin().getLog().info(
|
||||||
"Player {} will be migrated to the v2 database schema as a JAVA user", username);
|
"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);
|
callFastLoginPreLoginEvent(username, source, profile);
|
||||||
|
Reference in New Issue
Block a user