forked from TuxCoding/FastLogin
No duplicate login's like auth plugins auto logins if it's the same ip
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
* Remove deprecated API methods from the last version
|
||||
* Finally set a value to the API column
|
||||
* No duplicate session login
|
||||
|
||||
######1.9
|
||||
|
||||
|
@ -28,8 +28,10 @@ public class AuthMeHook implements AuthPlugin<Player> {
|
||||
public boolean forceLogin(Player player) {
|
||||
//skips registration and login
|
||||
if (isNewAPIAvailable) {
|
||||
NewAPI.getInstance().forceLogin(player);
|
||||
} else {
|
||||
if (!NewAPI.getInstance().isAuthenticated(player)) {
|
||||
NewAPI.getInstance().forceLogin(player);
|
||||
}
|
||||
} else if (!API.isAuthenticated(player)) {
|
||||
API.forceLogin(player);
|
||||
}
|
||||
|
||||
@ -50,6 +52,7 @@ public class AuthMeHook implements AuthPlugin<Player> {
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean forceRegister(Player player, String password) {
|
||||
if (isNewAPIAvailable) {
|
||||
//this automatically registers the player too
|
||||
NewAPI.getInstance().forceRegister(player, password);
|
||||
} else {
|
||||
API.registerPlayer(player.getName(), password);
|
||||
|
@ -5,6 +5,7 @@ import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
import io.github.lucaseasedup.logit.CancelledState;
|
||||
import io.github.lucaseasedup.logit.LogItCore;
|
||||
import io.github.lucaseasedup.logit.account.Account;
|
||||
import io.github.lucaseasedup.logit.session.SessionManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -19,7 +20,12 @@ public class LogItHook implements AuthPlugin<Player> {
|
||||
|
||||
@Override
|
||||
public boolean forceLogin(Player player) {
|
||||
return LogItCore.getInstance().getSessionManager().startSession(player) == CancelledState.NOT_CANCELLED;
|
||||
SessionManager sessionManager = LogItCore.getInstance().getSessionManager();
|
||||
if (sessionManager.isSessionAlive(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return sessionManager.startSession(player) == CancelledState.NOT_CANCELLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,6 +24,10 @@ public class LoginSecurityHook implements AuthPlugin<Player> {
|
||||
@Override
|
||||
public boolean forceLogin(Player player) {
|
||||
PlayerSession session = LoginSecurity.getSessionManager().getPlayerSession(player);
|
||||
if (session.isAuthorized()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return session.performAction(new LoginAction(AuthService.PLUGIN, plugin)).isSuccess();
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,10 @@ public class RoyalAuthHook implements AuthPlugin<Player> {
|
||||
AuthPlayer authPlayer = AuthPlayer.getAuthPlayer(player);
|
||||
|
||||
Future<Boolean> future = Bukkit.getScheduler().callSyncMethod(royalAuthPlugin, () -> {
|
||||
if (authPlayer.isLoggedIn()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//https://github.com/RoyalDev/RoyalAuth/blob/master/src/main/java/org/royaldev/royalauth/commands/CmdLogin.java#L62
|
||||
//not thread-safe
|
||||
authPlayer.login();
|
||||
|
@ -28,6 +28,10 @@ public class UltraAuthHook implements AuthPlugin<Player> {
|
||||
public boolean forceLogin(Player player) {
|
||||
//not thread-safe
|
||||
Future<Boolean> future = Bukkit.getScheduler().callSyncMethod(ultraAuthPlugin, () -> {
|
||||
if (UltraAuthAPI.isAuthenticated(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
UltraAuthAPI.authenticatedPlayer(player);
|
||||
return UltraAuthAPI.isAuthenticated(player);
|
||||
});
|
||||
|
@ -30,6 +30,10 @@ public class xAuthHook implements AuthPlugin<Player> {
|
||||
Future<Boolean> future = Bukkit.getScheduler().callSyncMethod(xAuthPlugin, () -> {
|
||||
xAuthPlayer xAuthPlayer = xAuthPlugin.getPlayerManager().getPlayer(player);
|
||||
if (xAuthPlayer != null) {
|
||||
if (xAuthPlayer.isAuthenticated()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//we checked that the player is premium (paid account)
|
||||
xAuthPlayer.setPremium(true);
|
||||
|
||||
|
Reference in New Issue
Block a user