Squash previous commits

* Add SodionAuth

* Add Comment

* add SodionAuth

Co-authored-by: logos <1102280066@qq.com>
This commit is contained in:
ishland
2020-07-29 09:22:17 +08:00
committed by GitHub
parent cae2f8f58d
commit 4acbcbfd19
5 changed files with 62 additions and 2 deletions

View File

@ -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](https://github.com/Mohist-Community/SodionAuth)
### BungeeCord/Waterfall

Binary file not shown.

View File

@ -233,5 +233,14 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/UltraAuth v2.1.2.jar</systemPath>
</dependency>
<dependency>
<groupId>red.mohist.sodionauth</groupId>
<artifactId>SodionAuth-Bukkit</artifactId>
<version>2.0-SNAPSHOT</version>
<optional>true</optional>
<scope>system</scope>
<systemPath>${project.basedir}/lib/SodionAuth-Bukkit-2.0-API-only.jar</systemPath>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,49 @@
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) {
plugin.getLog().warn("AutoRegister is not implemented by SodionAuth yet.");
plugin.getLog().warn("Disable it to prevent further issue!");
return false;
}
@Override
public boolean isRegistered(String playerName) {
return SodionAuthApi.isRegister(playerName);
}
}

View File

@ -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", "");