diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index c62d6c3a..fec516d4 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -98,21 +98,6 @@
-
-
- com.github.lenis0012
- LoginSecurity-2
-
- -9c09e73b7f-1
- true
-
-
- *
- *
-
-
-
-
com.lenis0012.bukkit
loginsecurity
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/DefaultPasswordGenerator.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/DefaultPasswordGenerator.java
deleted file mode 100644
index a6c5d522..00000000
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/DefaultPasswordGenerator.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.github.games647.fastlogin.bukkit;
-
-import org.apache.commons.lang.RandomStringUtils;
-import org.bukkit.entity.Player;
-
-public class DefaultPasswordGenerator implements PasswordGenerator {
-
- @Override
- public String getRandomPassword(Player player) {
- return RandomStringUtils.random(8, true, true);
- }
-}
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java
index 16c01a0f..4e146e13 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java
@@ -1,21 +1,11 @@
package com.github.games647.fastlogin.bukkit.hooks;
-import com.avaje.ebeaninternal.api.ClassUtil;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
-import com.google.common.base.Charsets;
import com.lenis0012.bukkit.loginsecurity.LoginSecurity;
import com.lenis0012.bukkit.loginsecurity.session.AuthService;
import com.lenis0012.bukkit.loginsecurity.session.PlayerSession;
import com.lenis0012.bukkit.loginsecurity.session.action.LoginAction;
import com.lenis0012.bukkit.loginsecurity.session.action.RegisterAction;
-import com.lenis0012.bukkit.ls.data.DataManager;
-
-import java.net.InetAddress;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -28,103 +18,23 @@ import org.bukkit.entity.Player;
*/
public class LoginSecurityHook implements BukkitAuthPlugin {
- protected final com.lenis0012.bukkit.ls.LoginSecurity securityPlugin;
- protected final FastLoginBukkit plugin = (FastLoginBukkit) Bukkit.getPluginManager().getPlugin("FastLogin");
- protected final boolean newVersion;
-
- public LoginSecurityHook() {
- this.newVersion = ClassUtil.isPresent("com.lenis0012.bukkit.loginsecurity.LoginSecurity", getClass());
- if (newVersion) {
- this.securityPlugin = null;
- } else {
- this.securityPlugin = com.lenis0012.bukkit.ls.LoginSecurity.instance;
- }
- }
+ private final FastLoginBukkit plugin = (FastLoginBukkit) Bukkit.getPluginManager().getPlugin("FastLogin");
@Override
public boolean forceLogin(Player player) {
- if (!newVersion) {
- return oldForceLogin(player);
- }
-
PlayerSession session = LoginSecurity.getSessionManager().getPlayerSession(player);
return session.performAction(new LoginAction(AuthService.PLUGIN, plugin)).isSuccess();
}
@Override
public boolean isRegistered(String playerName) throws Exception {
- if (!newVersion) {
- return oldIsRegistred(playerName);
- }
-
PlayerSession session = LoginSecurity.getSessionManager().getOfflineSession(playerName);
return session.isRegistered();
}
@Override
public boolean forceRegister(Player player, String password) {
- if (!newVersion) {
- return oldForceRegister(player, password);
- }
-
PlayerSession session = LoginSecurity.getSessionManager().getPlayerSession(player);
return session.performAction(new RegisterAction(AuthService.PLUGIN, plugin, password)).isSuccess();
}
-
- public boolean oldForceLogin(final Player player) {
-//Login command of this plugin: (How the plugin logs the player in)
- //https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/commands/LoginCommand.java#L39
-
- //not thread-safe operation
- Future future = Bukkit.getScheduler().callSyncMethod(securityPlugin, new Callable() {
- @Override
- public Boolean call() throws Exception {
- String name = player.getName().toLowerCase();
-
- //mark the user as logged in
- securityPlugin.authList.remove(name);
- //cancel timeout timer
- securityPlugin.thread.timeout.remove(name);
- //remove effects and restore location
- securityPlugin.rehabPlayer(player, name);
-
- return true;
- }
- });
-
- try {
- return future.get();
- } catch (InterruptedException | ExecutionException ex) {
- securityPlugin.getLogger().log(Level.SEVERE, "Failed to forceLogin", ex);
- return false;
- }
- }
-
- public boolean oldIsRegistred(String playerName) throws Exception {
- //https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/LoginSecurity.java#L296
- DataManager dataManager = securityPlugin.data;
-
- //https://github.com/lenis0012/LoginSecurity-2/blob/master/src/main/java/com/lenis0012/bukkit/ls/LoginSecurity.java#L283
- UUID offlineUuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(Charsets.UTF_8));
- return dataManager.isRegistered(offlineUuid.toString().replace("-", ""));
- }
-
- public boolean oldForceRegister(Player player, String password) {
- DataManager dataManager = securityPlugin.data;
-
- UUID playerUUID = player.getUniqueId();
- String uuidString = playerUUID.toString().replace("-", "");
- InetAddress ipAddress = player.getAddress().getAddress();
- String passwordHash = securityPlugin.hasher.hash(password);
-
- //this executes a sql query without interacting with other parts so we can run it async.
- dataManager.register(uuidString, passwordHash, securityPlugin.hasher.getTypeId(), ipAddress.toString());
- String storedPassword = dataManager.getPassword(uuidString);
- if (storedPassword != null && storedPassword.equals(passwordHash)) {
- //the register method silents any excpetion so check if our entry was saved
- return forceLogin(player);
- }
-
- return false;
- }
}
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
index f87e3db4..67c12f90 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
@@ -5,13 +5,10 @@ import com.github.games647.fastlogin.bungee.hooks.BungeeAuthPlugin;
import com.github.games647.fastlogin.bungee.listener.PlayerConnectionListener;
import com.github.games647.fastlogin.bungee.listener.PluginMessageListener;
import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import java.io.File;
import java.io.IOException;
import java.util.List;
-import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
@@ -30,8 +27,6 @@ public class FastLoginBungee extends Plugin {
private BungeeAuthPlugin bungeeAuthPlugin;
private Configuration config;
- private final Set pendingConfirms = Sets.newHashSet();
-
private final ConcurrentMap session = Maps.newConcurrentMap();
@Override
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/ImportCommand.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/ImportCommand.java
index ce812e97..b377fce5 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/ImportCommand.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/ImportCommand.java
@@ -2,7 +2,6 @@ package com.github.games647.fastlogin.bungee;
import com.github.games647.fastlogin.bungee.FastLoginBungee;
import com.github.games647.fastlogin.core.AuthStorage;
-import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.importer.ImportPlugin;
import net.md_5.bungee.api.ChatColor;
@@ -72,7 +71,7 @@ public class ImportCommand extends Command {
password = args[5];
}
- FastLoginCore core = plugin.getCore();
+ BungeeCore core = plugin.getCore();
AuthStorage storage = core.getStorage();
boolean success = core.importDatabase(importPlugin, true, storage, host, database, username, password);
if (success) {