diff --git a/CHANGELOG.md b/CHANGELOG.md
index 325ef975..ff49cbe7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
######1.10
+* Automatically register accounts if they are not in the auth plugin database but in the FastLogin database
+* Update BungeeAuth dependency and use the new API. Please update your plugin if you still use the old one.
* Remove deprecated API methods from the last version
* Finally set a value to the API column
* No duplicate session login
diff --git a/bungee/pom.xml b/bungee/pom.xml
index 198612d6..ffb5dcf7 100644
--- a/bungee/pom.xml
+++ b/bungee/pom.xml
@@ -47,7 +47,13 @@
me.vik1395
BungeeAuth
- 1.3.1
+ 1.4
+
+
+ *
+ *
+
+
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java
index 1f282708..f938d26d 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java
@@ -2,16 +2,8 @@ package com.github.games647.fastlogin.bungee.hooks;
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
-import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Random;
-import java.util.logging.Level;
-
-import me.vik1395.BungeeAuth.ListenerClass;
import me.vik1395.BungeeAuth.Main;
-import me.vik1395.BungeeAuth.Password.PasswordHandler;
-import me.vik1395.BungeeAuth.Tables;
+import me.vik1395.BungeeAuthAPI.RequestHandler;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@@ -24,87 +16,25 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
*/
public class BungeeAuthHook implements AuthPlugin {
- //https://github.com/vik1395/BungeeAuth-Minecraft/blob/master/src/me/vik1395/BungeeAuth/Login.java#L32
- private final Tables databaseConnection = new Tables();
+ private final RequestHandler requestHandler = new RequestHandler();
@Override
public boolean forceLogin(ProxiedPlayer player) {
String playerName = player.getName();
-//https://github.com/vik1395/BungeeAuth-Minecraft/blob/master/src/me/vik1395/BungeeAuth/Login.java#L92-95
if (Main.plonline.contains(playerName)) {
return true;
}
- Main.plonline.add(playerName);
-
- //renamed from ct to databaseConnection
-// databaseConnection.setStatus(player.getName(), "online");
- Class>[] parameterTypes = new Class>[]{String.class, String.class};
- Object[] arguments = new Object[]{playerName, "online"};
-
- try {
- callProtected("setStatus", parameterTypes, arguments);
- ListenerClass.movePlayer(player, false);
-
- //proparly not thread-safe
- ListenerClass.prelogin.get(playerName).cancel();
- } catch (Exception ex) {
- Main.plugin.getLogger().log(Level.SEVERE, "Error force loging in player", ex);
- return false;
- }
-
- return true;
+ return requestHandler.forceLogin(playerName);
}
@Override
public boolean isRegistered(String playerName) throws Exception {
- //https://github.com/vik1395/BungeeAuth-Minecraft/blob/master/src/me/vik1395/BungeeAuth/Register.java#L46
- //renamed t to databaseConnection
- return databaseConnection.checkPlayerEntry(playerName);
+ return requestHandler.isRegistered(playerName);
}
@Override
public boolean forceRegister(ProxiedPlayer player, String password) {
- //https://github.com/vik1395/BungeeAuth-Minecraft/blob/master/src/me/vik1395/BungeeAuth/Register.java#L102
- PasswordHandler ph = new PasswordHandler();
- Random rand = new Random();
- int maxp = 7; //Total Password Hashing methods.
- Date dNow = new Date();
- SimpleDateFormat ft = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
-
- String Pw = password;
- String pType = "" + rand.nextInt(maxp + 1);
- String regdate = ft.format(dNow);
- //https://github.com/vik1395/BungeeAuth-Minecraft/blob/master/src/me/vik1395/BungeeAuth/Register.java#L60
- String lastip = player.getAddress().getAddress().getHostAddress();
- String lastseen = regdate;
- String hash = ph.newHash(Pw, pType);
-
- //creates a new SQL entry with the player's details.
- Class>[] parameterTypes = new Class>[] {String.class, String.class, String.class, String.class
- , String.class, String.class, String.class, String.class};
- Object[] arguments = new Object[] {player.getName(), hash, pType, "", lastip, regdate, lastip, lastseen};
-
- try {
- callProtected("newPlayerEntry", parameterTypes, arguments);
- //proparly not thread-safe
- forceLogin(player);
- } catch (Exception ex) {
- Main.plugin.getLogger().log(Level.SEVERE, "[BungeeAuth] Error when creating a new player in the Database", ex);
- return false;
- }
-
- return true;
- }
-
- //pail ;(
- private void callProtected(String methodName, Class>[] parameterTypes, Object[] arguments) throws Exception {
- Class tableClass = Tables.class;
-
- Method method = tableClass.getDeclaredMethod(methodName, parameterTypes);
- method.setAccessible(true);
- //renamed t to databaseConnection
- //databaseConnection.newPlayerEntry(player.getName(), hash, pType, "", lastip, regdate, lastip, lastseen);
- method.invoke(databaseConnection, arguments);
+ return requestHandler.forceRegister(player, password);
}
}
diff --git a/core/pom.xml b/core/pom.xml
index a5e6c2cb..8686174e 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -19,7 +19,7 @@
com.zaxxer
HikariCP
- 2.5.0
+ 2.5.1