mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Implement autoLoginFloodgate & autoRegisterFloodgate config options
Knwon Bug: Profile.isSaved() is 'false' when logging in from Bedrock after auto registering through Bedrock so FastLogin will try to register for a second time, insted of logging in
This commit is contained in:
@ -71,8 +71,9 @@ public class ConnectionListener implements Listener {
|
|||||||
"Player {} is connecting through Geyser Floodgate.",
|
"Player {} is connecting through Geyser Floodgate.",
|
||||||
player.getName());
|
player.getName());
|
||||||
String allowNameConflict = plugin.getCore().getConfig().getString("allowFloodgateNameConflict");
|
String allowNameConflict = plugin.getCore().getConfig().getString("allowFloodgateNameConflict");
|
||||||
if (allowNameConflict.equalsIgnoreCase("linked") &&
|
// check if the Bedrock player is linked to a Java account
|
||||||
floodgatePlayer.fetchLinkedPlayer() == null) {
|
boolean isLinked = floodgatePlayer.fetchLinkedPlayer() != null;
|
||||||
|
if (allowNameConflict.equalsIgnoreCase("linked") && !isLinked) {
|
||||||
plugin.getLog().info(
|
plugin.getLog().info(
|
||||||
"Bedrock Player {}'s name conflits an existing Java Premium Player's name",
|
"Bedrock Player {}'s name conflits an existing Java Premium Player's name",
|
||||||
player.getName());
|
player.getName());
|
||||||
@ -88,13 +89,16 @@ public class ConnectionListener implements Listener {
|
|||||||
|
|
||||||
StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName());
|
StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName());
|
||||||
|
|
||||||
|
String autoLoginFloodgate = plugin.getCore().getConfig().getString("autoLoginFloodgate");
|
||||||
|
boolean autoRegisterFloodgate = plugin.getCore().getConfig().getBoolean("autoRegisterFloodgate");
|
||||||
|
|
||||||
// create fake session to make auto login work
|
// create fake session to make auto login work
|
||||||
session = new BukkitLoginSession(player.getName(), profile.isSaved());
|
// the player should only be registered (=> parm. registered = false) if
|
||||||
session.setVerified(true);
|
// the player is not registered and autoRegister is enabled in the config
|
||||||
|
session = new BukkitLoginSession(player.getName(), profile.isSaved() || !autoRegisterFloodgate);
|
||||||
// TODO: configurate auto login for floodgate players
|
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
|
||||||
// TODO: fix bug: registering as bedrock player breaks java auto login
|
session.setVerified(autoLoginFloodgate.equalsIgnoreCase("true")
|
||||||
|
|| (autoLoginFloodgate.equalsIgnoreCase("linked") && isLinked));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
|
@ -212,6 +212,7 @@ autoLoginFloodgate: 'false'
|
|||||||
allowFloodgateNameConflict: 'false'
|
allowFloodgateNameConflict: 'false'
|
||||||
|
|
||||||
# This enables auto registering every player connecting through Floodgate.
|
# This enables auto registering every player connecting through Floodgate.
|
||||||
|
# autoLoginFloodgate must be 'true' for this to work
|
||||||
autoRegisterFloodgate: false
|
autoRegisterFloodgate: false
|
||||||
|
|
||||||
# Database configuration
|
# Database configuration
|
||||||
|
Reference in New Issue
Block a user