Create a profile for Bedrock players when registering

This commit is contained in:
Smart123s
2021-03-22 19:51:46 +01:00
parent 9abc99ebc2
commit 5d94e610ff

View File

@@ -10,6 +10,7 @@ import org.geysermc.floodgate.FloodgatePlayer;
import com.github.games647.fastlogin.bukkit.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit; import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.hooks.AuthPlugin; import com.github.games647.fastlogin.core.hooks.AuthPlugin;
public class FloodgateAuthTask implements Runnable { public class FloodgateAuthTask implements Runnable {
@@ -40,7 +41,7 @@ public class FloodgateAuthTask implements Runnable {
} }
if (!allowNameConflict.equalsIgnoreCase("true") && !allowNameConflict.equalsIgnoreCase("linked")) { if (!allowNameConflict.equalsIgnoreCase("true") && !allowNameConflict.equalsIgnoreCase("linked")) {
plugin.getLog().error( plugin.getLog().error(
"Invalid value detected for 'allowNameConflict' in FasttLogin/config.yml. Aborting login of Player {}", "Invalid value detected for 'allowFloodgateNameConflict' in FasttLogin/config.yml. Aborting login of Player {}",
player.getName()); player.getName());
return; return;
} }
@@ -66,7 +67,13 @@ public class FloodgateAuthTask implements Runnable {
return; return;
} }
BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered); // logging in from bedrock for a second time threw an error with UUID
StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName());
if (profile == null) {
profile = new StoredProfile(player.getUniqueId(), player.getName(), true, player.getAddress().toString());
}
BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered, profile);
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml // enable auto login based on the value of 'autoLoginFloodgate' in config.yml
session.setVerified(autoLoginFloodgate.equalsIgnoreCase("true") session.setVerified(autoLoginFloodgate.equalsIgnoreCase("true")