mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
@ -81,6 +81,7 @@ Possible values: `Premium`, `Cracked`, `Unknown`
|
||||
* [CrazyLogin](https://dev.bukkit.org/bukkit-plugins/crazylogin/)
|
||||
* [LoginSecurity](https://dev.bukkit.org/bukkit-plugins/loginsecurity/)
|
||||
* [UltraAuth](https://dev.bukkit.org/bukkit-plugins/ultraauth-aa/)
|
||||
* [SodionAuth (2.0+)](https://github.com/Mohist-Community/SodionAuth)
|
||||
|
||||
### BungeeCord/Waterfall
|
||||
|
||||
|
@ -233,5 +233,19 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/UltraAuth v2.1.2.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.Mohist-Community.SodionAuth</groupId>
|
||||
<artifactId>SodionAuth-Bukkit</artifactId>
|
||||
<version>b74392aa34</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.Mohist-Community.SodionAuth</groupId>
|
||||
<artifactId>SodionAuth-Libs</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -0,0 +1,53 @@
|
||||
package com.github.games647.fastlogin.bukkit.hook;
|
||||
|
||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
import org.bukkit.entity.Player;
|
||||
import red.mohist.sodionauth.bukkit.implementation.BukkitPlayer;
|
||||
import red.mohist.sodionauth.core.SodionAuthApi;
|
||||
import red.mohist.sodionauth.core.exception.AuthenticatedException;
|
||||
|
||||
/**
|
||||
* GitHub: https://github.com/Mohist-Community/SodionAuth
|
||||
* <p>
|
||||
* Project page:
|
||||
* <p>
|
||||
* Bukkit: Unknown
|
||||
* <p>
|
||||
* Spigot: Unknown
|
||||
*/
|
||||
public class SodionAuthHook implements AuthPlugin<Player> {
|
||||
|
||||
private final FastLoginBukkit plugin;
|
||||
|
||||
public SodionAuthHook(FastLoginBukkit plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forceLogin(Player player) {
|
||||
try {
|
||||
SodionAuthApi.login(new BukkitPlayer(player));
|
||||
} catch (AuthenticatedException e) {
|
||||
plugin.getLog().warn(ALREADY_AUTHENTICATED, player);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forceRegister(Player player, String password) {
|
||||
try{
|
||||
return SodionAuthApi.register(new BukkitPlayer(player), password);
|
||||
} catch (UnsupportedOperationException e){
|
||||
plugin.getLog().warn("Currently SodionAuth is not accepting forceRegister, " +
|
||||
"It may be caused by unsupported AuthBackend");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegistered(String playerName) {
|
||||
return SodionAuthApi.isRegistered(playerName);
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.github.games647.fastlogin.bukkit.hook.LogItHook;
|
||||
import com.github.games647.fastlogin.bukkit.hook.LoginSecurityHook;
|
||||
import com.github.games647.fastlogin.bukkit.hook.UltraAuthHook;
|
||||
import com.github.games647.fastlogin.bukkit.hook.xAuthHook;
|
||||
import com.github.games647.fastlogin.bukkit.hook.SodionAuthHook;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
@ -70,8 +71,8 @@ public class DelayedAuthHook implements Runnable {
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Class<? extends AuthPlugin<Player>>> hooks = Arrays.asList(AuthMeHook.class,
|
||||
CrazyLoginHook.class, LogItHook.class, LoginSecurityHook.class, UltraAuthHook.class,
|
||||
xAuthHook.class);
|
||||
CrazyLoginHook.class, LogItHook.class, LoginSecurityHook.class,
|
||||
SodionAuthHook.class, UltraAuthHook.class, xAuthHook.class);
|
||||
|
||||
for (Class<? extends AuthPlugin<Player>> clazz : hooks) {
|
||||
String pluginName = clazz.getSimpleName().replace("Hook", "");
|
||||
|
Reference in New Issue
Block a user