forked from TuxCoding/FastLogin
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> {
|
||||
|
||||
Reference in New Issue
Block a user