Add 'linked' option to 'autoRegisterFloodgate'

This makes sense with Floodgate 2.0's Global Link API
This commit is contained in:
Smart123s
2021-06-21 15:15:18 +02:00
parent 5442f773ae
commit 2626c21bc8
2 changed files with 13 additions and 1 deletions

View File

@ -105,7 +105,7 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
}
}
if (!isRegistered && autoRegisterFloodgate.equals("false")) {
if (!isRegistered && !isAutoRegisterAllowed()) {
return;
}
@ -120,6 +120,17 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
}
/**
* Decude if the player can be auto registered.
* The config option 'non-conflicting' is ignored by this function.
* @return true if the Player can be registered automatically
*/
private boolean isAutoRegisterAllowed() {
return autoRegisterFloodgate.equals("true")
|| autoRegisterFloodgate.equals("no-conflict") // this was checked before
|| (autoRegisterFloodgate.equals("linked") && isLinked);
}
/**
* Decides wether checks for conflicting Java names should be made
* @return ture if an API call to Mojang is needed

View File

@ -234,6 +234,7 @@ allowFloodgateNameConflict: false
# Possible values:
# false: Disables auto registering for every player connecting through Floodgate
# true: Enables auto registering for every player connecting through Floodgate
# linked: Only Bedrock accounts that are linked to a Java account will be registered automatically
# no-conflict: Bedrock players will only be automatically registered if the Mojang API reports
# that there is no existing Premium Java MC account with their name.
# This option can be useful if you are not using 'username-prefix' in floodgate/config.yml