mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Use authPlugin.isRegistered() instead of profile.isSaved()
This commit is contained in:
@ -3,7 +3,7 @@ package com.github.games647.fastlogin.bukkit.listener;
|
|||||||
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.bukkit.task.ForceLoginTask;
|
import com.github.games647.fastlogin.bukkit.task.ForceLoginTask;
|
||||||
import com.github.games647.fastlogin.core.StoredProfile;
|
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -87,7 +87,7 @@ public class ConnectionListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName());
|
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
|
||||||
|
|
||||||
String autoLoginFloodgate = plugin.getCore().getConfig().getString("autoLoginFloodgate");
|
String autoLoginFloodgate = plugin.getCore().getConfig().getString("autoLoginFloodgate");
|
||||||
boolean autoRegisterFloodgate = plugin.getCore().getConfig().getBoolean("autoRegisterFloodgate");
|
boolean autoRegisterFloodgate = plugin.getCore().getConfig().getBoolean("autoRegisterFloodgate");
|
||||||
@ -95,10 +95,17 @@ public class ConnectionListener implements Listener {
|
|||||||
// create fake session to make auto login work
|
// create fake session to make auto login work
|
||||||
// the player should only be registered (=> parm. registered = false) if
|
// the player should only be registered (=> parm. registered = false) if
|
||||||
// the player is not registered and autoRegister is enabled in the config
|
// the player is not registered and autoRegister is enabled in the config
|
||||||
session = new BukkitLoginSession(player.getName(), profile.isSaved() || !autoRegisterFloodgate);
|
try {
|
||||||
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
|
session = new BukkitLoginSession(player.getName(), authPlugin.isRegistered(player.getName()) || !autoRegisterFloodgate);
|
||||||
session.setVerified(autoLoginFloodgate.equalsIgnoreCase("true")
|
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
|
||||||
|| (autoLoginFloodgate.equalsIgnoreCase("linked") && isLinked));
|
session.setVerified(autoLoginFloodgate.equalsIgnoreCase("true")
|
||||||
|
|| (autoLoginFloodgate.equalsIgnoreCase("linked") && isLinked));
|
||||||
|
} catch (Exception e) {
|
||||||
|
plugin.getLog().error(
|
||||||
|
"An error has occured while checking if player {} is registered",
|
||||||
|
player.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
|
Reference in New Issue
Block a user