Added support for UltraAuth

This commit is contained in:
games647
2016-03-01 17:26:25 +01:00
parent 015739fe4c
commit 8fc5050e8e
8 changed files with 75 additions and 6 deletions

View File

@ -36,6 +36,7 @@ So they don't need to enter passwords. This is also called auto login (auto-logi
* [CrazyLogin](http://dev.bukkit.org/bukkit-plugins/crazylogin/)
* [LoginSecurity](http://dev.bukkit.org/bukkit-plugins/loginsecurity/)
* [RoyalAuth](http://dev.bukkit.org/bukkit-plugins/royalauth/)
* [UltraAuth](http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/)
###Downloads

Binary file not shown.

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>fastlogin-parent</artifactId>
<version>0.5</version>
<version>0.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -52,7 +52,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<version>1.9-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -128,5 +128,14 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/CrazyLogin v7.23.2.jar</systemPath>
</dependency>
<dependency>
<groupId>ultraauth</groupId>
<artifactId>ultraauth</artifactId>
<version>2.0.2</version>
<optional>true</optional>
<scope>system</scope>
<systemPath>${project.basedir}/lib/UltraAuth v2.0.2.jar</systemPath>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,58 @@
package com.github.games647.fastlogin.bukkit.hooks;
import java.lang.reflect.Method;
import net.sf.cglib.proxy.Callback;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import net.sf.cglib.proxy.NoOp;
import org.bukkit.entity.Player;
import ultraauth.api.UltraAuthAPI;
/**
* Project page: http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
*/
public class UltraAuthHook implements AuthPlugin {
@Override
public void forceLogin(Player player) {
UltraAuthAPI.authenticatedPlayer(player);
}
@Override
public boolean isRegistered(final String playerName) {
return UltraAuthAPI.isRegisterd(createFakePlayer(playerName));
}
private Player createFakePlayer(final String playerName) {
Callback implementation = new MethodInterceptor() {
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
String methodName = method.getName();
if (methodName.equals("getName")) {
return playerName;
}
// Ignore all other methods
throw new UnsupportedOperationException(
"The method " + method.getName() + " is not supported for temporary players.");
}
};
// CGLib is amazing
Enhancer ex = new Enhancer();
ex.setInterfaces(new Class<?>[]{Player.class});
ex.setCallbacks(new Callback[]{NoOp.INSTANCE, implementation});
return (Player) ex.create();
}
@Override
public void forceRegister(Player player, String password) {
UltraAuthAPI.setPlayerPasswordOnline(player, password);
}
}

View File

@ -22,6 +22,7 @@ softdepend:
- CrazyLogin
- LoginSecurity
- RoyalAuth
- UltraAuth
commands:
${project.parent.name}:

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>fastlogin-parent</artifactId>
<version>0.5</version>
<version>0.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -28,7 +28,7 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.8-SNAPSHOT</version>
<version>1.9-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>

View File

@ -8,7 +8,7 @@
<packaging>pom</packaging>
<name>FastLogin</name>
<version>0.5</version>
<version>0.6</version>
<inceptionYear>2015</inceptionYear>
<url>https://www.spigotmc.org/resources/fastlogin.14153/</url>
<description>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.github.games647</groupId>
<artifactId>fastlogin-parent</artifactId>
<version>0.5</version>
<version>0.6</version>
<relativePath>../pom.xml</relativePath>
</parent>