mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-08-01 03:34:44 +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;
|
package com.github.games647.fastlogin.bukkit.hooks;
|
||||||
|
|
||||||
import com.avaje.ebeaninternal.api.ClassUtil;
|
|
||||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||||
|
|
||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.api.NewAPI;
|
import fr.xephi.authme.api.NewAPI;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Github: https://github.com/Xephi/AuthMeReloaded/
|
* Github: https://github.com/Xephi/AuthMeReloaded/
|
||||||
|
*
|
||||||
* Project page:
|
* Project page:
|
||||||
*
|
*
|
||||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
* Bukkit: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
||||||
|
*
|
||||||
* Spigot: https://www.spigotmc.org/resources/authme-reloaded.6269/
|
* Spigot: https://www.spigotmc.org/resources/authme-reloaded.6269/
|
||||||
*/
|
*/
|
||||||
public class AuthMeHook implements AuthPlugin<Player> {
|
public class AuthMeHook implements AuthPlugin<Player> {
|
||||||
@@ -20,7 +23,15 @@ public class AuthMeHook implements AuthPlugin<Player> {
|
|||||||
private final boolean isNewAPIAvailable;
|
private final boolean isNewAPIAvailable;
|
||||||
|
|
||||||
public AuthMeHook() {
|
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
|
@Override
|
||||||
@@ -28,7 +39,9 @@ public class AuthMeHook implements AuthPlugin<Player> {
|
|||||||
public boolean forceLogin(Player player) {
|
public boolean forceLogin(Player player) {
|
||||||
//skips registration and login
|
//skips registration and login
|
||||||
if (isNewAPIAvailable) {
|
if (isNewAPIAvailable) {
|
||||||
if (!NewAPI.getInstance().isAuthenticated(player)) {
|
if (NewAPI.getInstance().isAuthenticated(player)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
NewAPI.getInstance().forceLogin(player);
|
NewAPI.getInstance().forceLogin(player);
|
||||||
}
|
}
|
||||||
} else if (!API.isAuthenticated(player)) {
|
} else if (!API.isAuthenticated(player)) {
|
||||||
|
@@ -18,6 +18,7 @@ import ultraauth.managers.PlayerManager;
|
|||||||
* Project page:
|
* Project page:
|
||||||
*
|
*
|
||||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
|
* Bukkit: http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
|
||||||
|
*
|
||||||
* Spigot: https://www.spigotmc.org/resources/ultraauth.17044/
|
* Spigot: https://www.spigotmc.org/resources/ultraauth.17044/
|
||||||
*/
|
*/
|
||||||
public class UltraAuthHook implements AuthPlugin<Player> {
|
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
|
//update only on success to prevent corrupt data
|
||||||
if (playerProfile != null) {
|
if (playerProfile != null) {
|
||||||
playerProfile.setUuid(session.getUuid());
|
playerProfile.setUuid(session.getUuid());
|
||||||
//save cracked players too
|
|
||||||
playerProfile.setPremium(true);
|
playerProfile.setPremium(true);
|
||||||
storage.save(playerProfile);
|
storage.save(playerProfile);
|
||||||
}
|
}
|
||||||
@@ -67,7 +66,7 @@ public abstract class ForceLoginMangement<P extends C, C, L extends LoginSession
|
|||||||
storage.save(playerProfile);
|
storage.save(playerProfile);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} 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