mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Do no print auto login message on authme session reuse (Related #101)
This commit is contained in:
@ -1,18 +1,21 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.avaje.ebeaninternal.api.ClassUtil;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import fr.xephi.authme.api.API;
|
||||
import fr.xephi.authme.api.NewAPI;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Github: https://github.com/Xephi/AuthMeReloaded/
|
||||
*
|
||||
* Project page:
|
||||
*
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
||||
*
|
||||
* Spigot: https://www.spigotmc.org/resources/authme-reloaded.6269/
|
||||
*/
|
||||
public class AuthMeHook implements AuthPlugin<Player> {
|
||||
@ -20,7 +23,15 @@ public class AuthMeHook implements AuthPlugin<Player> {
|
||||
private final boolean isNewAPIAvailable;
|
||||
|
||||
public AuthMeHook() {
|
||||
this.isNewAPIAvailable = ClassUtil.isPresent("fr.xephi.authme.api.NewAPI");
|
||||
boolean apiAvailable = false;
|
||||
try {
|
||||
Class.forName("fr.xephi.authme.api.NewAPI");
|
||||
apiAvailable = true;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Logger.getLogger(AuthMeHook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
this.isNewAPIAvailable = apiAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,13 +39,15 @@ public class AuthMeHook implements AuthPlugin<Player> {
|
||||
public boolean forceLogin(Player player) {
|
||||
//skips registration and login
|
||||
if (isNewAPIAvailable) {
|
||||
if (!NewAPI.getInstance().isAuthenticated(player)) {
|
||||
if (NewAPI.getInstance().isAuthenticated(player)) {
|
||||
return false;
|
||||
} else {
|
||||
NewAPI.getInstance().forceLogin(player);
|
||||
}
|
||||
} else if (!API.isAuthenticated(player)) {
|
||||
API.forceLogin(player);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import ultraauth.managers.PlayerManager;
|
||||
* Project page:
|
||||
*
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
|
||||
*
|
||||
* Spigot: https://www.spigotmc.org/resources/ultraauth.17044/
|
||||
*/
|
||||
public class UltraAuthHook implements AuthPlugin<Player> {
|
||||
|
@ -52,7 +52,6 @@ public abstract class ForceLoginMangement<P extends C, C, L extends LoginSession
|
||||
//update only on success to prevent corrupt data
|
||||
if (playerProfile != null) {
|
||||
playerProfile.setUuid(session.getUuid());
|
||||
//save cracked players too
|
||||
playerProfile.setPremium(true);
|
||||
storage.save(playerProfile);
|
||||
}
|
||||
@ -67,7 +66,7 @@ public abstract class ForceLoginMangement<P extends C, C, L extends LoginSession
|
||||
storage.save(playerProfile);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
core.getPlugin().getLogger().log(Level.INFO, "ERROR ON FORCE LOGIN", ex);
|
||||
core.getPlugin().getLogger().log(Level.WARNING, "ERROR ON FORCE LOGIN", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user