diff --git a/README.md b/README.md index 358a7cfb..b5acae72 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ So they don't need to enter passwords. This is also called auto login (auto-logi * Run Spigot and/or BungeeCord/Waterfall in offline mode (see server.properties or config.yml) * An auth plugin. Supported plugins -#### Bukkit/Spigot/PaperSpigot +#### Bukkit/Spigot/Paper * [AuthMe (both 5.X and 3.X)](https://dev.bukkit.org/bukkit-plugins/authme-reloaded/) * [xAuth](https://dev.bukkit.org/bukkit-plugins/xauth/) @@ -67,7 +67,7 @@ https://www.spigotmc.org/resources/fastlogin.14153/history ### How to install -#### Bukkit/Spigot/PaperSpigot +#### Bukkit/Spigot/Paper 1. Download and install ProtocolLib 2. Download and install FastLogin diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index cfe51ce7..ad762bf7 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -1,7 +1,6 @@ package com.github.games647.fastlogin.bukkit; import com.github.games647.fastlogin.bukkit.commands.CrackedCommand; -import com.github.games647.fastlogin.bukkit.commands.ImportCommand; import com.github.games647.fastlogin.bukkit.commands.PremiumCommand; import com.github.games647.fastlogin.bukkit.listener.BukkitJoinListener; import com.github.games647.fastlogin.bukkit.listener.BungeeCordListener; @@ -102,7 +101,6 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin core; - - public ImportCommand(FastLoginCore core) { - this.core = core; - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (args.length < 2) { - sender.sendMessage(ChatColor.DARK_RED + "You need to specify the import plugin and database type"); - return true; - } - - ImportPlugin importPlugin; - switch (args[0].toLowerCase()) { - case "autoin": - importPlugin = ImportPlugin.AUTO_IN; - break; - case "bpa": - importPlugin = ImportPlugin.BPA; - break; - case "eldzi": - importPlugin = ImportPlugin.ELDZI; - break; - default: - sender.sendMessage(ChatColor.DARK_RED + "Unknown auto login plugin"); - return true; - } - - boolean sqlite; - switch (args[1].toLowerCase()) { - case "sqlite": - sqlite = true; - break; - case "mysql": - sqlite = false; - break; - default: - sender.sendMessage(ChatColor.DARK_RED + "Unknown storage type to import from. Either SQLite or MySQL"); - return true; - } - - String host = ""; - String database = ""; - String username = ""; - String password = ""; - if (!sqlite) { - if (args.length <= 5) { - sender.sendMessage(ChatColor.DARK_RED + "If importing from MySQL, you need to specify host database " - + "and username passowrd too"); - return true; - } - - host = args[2]; - database = args[3]; - username = args[4]; - password = args[5]; - } - - AuthStorage storage = core.getStorage(); - boolean success = core.importDatabase(importPlugin, true, storage, host, database, username, password); - if (success) { - sender.sendMessage(ChatColor.DARK_GREEN + "Successful imported the data"); - } else { - sender.sendMessage(ChatColor.DARK_RED + "Failed to import the data. Check out the logs"); - } - - return true; - } -} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java index 95e96fa0..1f1655f7 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java @@ -170,7 +170,6 @@ public class VerifyResponseTask implements Runnable { PacketContainer kickPacket = protocolManager.createPacket(PacketType.Login.Server.DISCONNECT); kickPacket.getChatComponents().write(0, WrappedChatComponent.fromText(reason)); - try { //send kick packet at login state //the normal event.getPlayer.kickPlayer(String) method does only work at play state diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index ffffca08..c266c75c 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -33,11 +33,6 @@ commands: usage: / [player] permission: ${project.artifactId}.command.cracked - import-auth: - description: 'Imports the auth data from another auto login' - usage: / [player] - permission: ${project.artifactId}.command.import - permissions: ${project.artifactId}.command.premium: description: 'Label themselves as premium' 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 271a0d73..0a3671cb 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 @@ -49,9 +49,6 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin core; - - public ImportCommand(FastLoginBungee plugin) { - super("import-db", plugin.getDescription().getName().toLowerCase() + ".import"); - - this.core = plugin.getCore(); - } - - @Override - public void execute(CommandSender sender, String[] args) { - if (args.length < 2) { - String message = ChatColor.DARK_RED + "You need to specify the import plugin and database type"; - sender.sendMessage(convertFromLegacy(message)); - return; - } - - ImportPlugin importPlugin; - switch (args[0].toLowerCase()) { - case "autoin": - importPlugin = ImportPlugin.AUTO_IN; - break; - case "bpa": - importPlugin = ImportPlugin.BPA; - break; - case "eldzi": - importPlugin = ImportPlugin.ELDZI; - break; - default: - String message = ChatColor.DARK_RED + "Unknown auto login plugin"; - sender.sendMessage(convertFromLegacy(message)); - return; - } - - boolean sqlite; - switch (args[1].toLowerCase()) { - case "sqlite": - sqlite = true; - break; - case "mysql": - sqlite = false; - break; - default: - String message = ChatColor.DARK_RED + "Unknown storage type to import from. Either SQLite or MySQL"; - sender.sendMessage(convertFromLegacy(message)); - return; - } - - String host = ""; - String database = ""; - String username = ""; - String password = ""; - if (!sqlite) { - if (args.length <= 5) { - String message = ChatColor.DARK_RED + "If importing from MySQL, you need to specify host database " - + "and username passowrd too"; - sender.sendMessage(convertFromLegacy(message)); - return; - } - - host = args[2]; - database = args[3]; - username = args[4]; - password = args[5]; - } - - AuthStorage storage = core.getStorage(); - boolean success = core.importDatabase(importPlugin, true, storage, host, database, username, password); - if (success) { - sender.sendMessage(convertFromLegacy(ChatColor.DARK_GREEN + "Successful imported the data")); - } else { - sender.sendMessage(convertFromLegacy(ChatColor.DARK_RED + "Failed to import the data. Check out the logs")); - } - } - - private BaseComponent[] convertFromLegacy(String message) { - return TextComponent.fromLegacyText(message); - } -} diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/ForceLoginTask.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/ForceLoginTask.java index 7d41b1f4..1d650ad4 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/ForceLoginTask.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/ForceLoginTask.java @@ -64,7 +64,7 @@ public class ForceLoginTask extends ForceLoginMangement importerClass; - - ImportPlugin(Class importer) { - this.importerClass = importer; - } - - public Class getImporter() { - return importerClass; - } -} diff --git a/core/src/main/java/com/github/games647/fastlogin/core/importer/Importer.java b/core/src/main/java/com/github/games647/fastlogin/core/importer/Importer.java deleted file mode 100644 index f316524c..00000000 --- a/core/src/main/java/com/github/games647/fastlogin/core/importer/Importer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.github.games647.fastlogin.core.importer; - -import com.github.games647.fastlogin.core.AuthStorage; - -import java.sql.Connection; -import java.sql.SQLException; - -import javax.sql.DataSource; - -public abstract class Importer { - - public abstract int importData(Connection source, DataSource target, AuthStorage storage) throws SQLException; - - protected void closeQuietly(AutoCloseable closeable) { - if (closeable != null) { - try { - closeable.close(); - } catch (Exception ignore) { - //ignore - } - } - } -} diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java index bfd73066..474929ae 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java @@ -6,9 +6,6 @@ import com.github.games647.fastlogin.core.SharedConfig; import com.github.games647.fastlogin.core.hooks.AuthPlugin; import com.github.games647.fastlogin.core.hooks.DefaultPasswordGenerator; import com.github.games647.fastlogin.core.hooks.PasswordGenerator; -import com.github.games647.fastlogin.core.importer.AutoInImporter; -import com.github.games647.fastlogin.core.importer.ImportPlugin; -import com.github.games647.fastlogin.core.importer.Importer; import com.google.common.cache.CacheLoader; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -19,9 +16,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.nio.file.Files; import java.nio.file.Path; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; import java.util.Collection; import java.util.List; import java.util.Map; @@ -180,46 +174,6 @@ public class FastLoginCore

> { } } - public boolean importDatabase(ImportPlugin importPlugin, boolean sqlite, AuthStorage storage, String host, String database - , String username, String pass) { - if (sqlite && (importPlugin == ImportPlugin.BPA || importPlugin == ImportPlugin.ELDZI)) { - throw new IllegalArgumentException("These plugins doesn't support flat file databases"); - } - - Importer importer; - try { - importer = importPlugin.getImporter().newInstance(); - } catch (Exception ex) { - plugin.getLogger().log(Level.SEVERE, "Couldn't not setup importer class", ex); - return false; - } - - try { - if (sqlite && importPlugin == ImportPlugin.AUTO_IN) { - //load SQLite driver - Class.forName("org.sqlite.JDBC"); - - String jdbcUrl = "jdbc:sqlite:" + AutoInImporter.getSQLitePath(); - Connection con = DriverManager.getConnection(jdbcUrl); - importer.importData(con, storage.getDataSource(), storage); - return true; - } else { - Class.forName("com.mysql.jdbc.Driver"); - - String jdbcUrl = "jdbc:mysql://" + host + '/' + database; - Connection con = DriverManager.getConnection(jdbcUrl, username, pass); - importer.importData(con, storage.getDataSource(), storage); - return true; - } - } catch (ClassNotFoundException ex) { - plugin.getLogger().log(Level.SEVERE, "Cannot find SQL driver. Do you removed it?", ex); - } catch (SQLException ex) { - plugin.getLogger().log(Level.SEVERE, "Couldn't import data. Aborting...", ex); - } - - return false; - } - public SharedConfig getConfig() { return sharedConfig; } diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 5133dc7a..f828cf1c 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -52,7 +52,7 @@ switchMode: false # will have the same inventory, permissions, ... if they switched to premium authentification from offline/cracked # authentication. # -# This feature requires Cauldron, Spigot or a fork of Spigot (PaperSpigot, TacoSpigot) +# This feature requires Cauldron, Spigot or a fork of Spigot (Paper) premiumUuid: false # This will make an additional check (only for player names which are not in the database) against the mojang servers diff --git a/core/src/main/resources/messages.yml b/core/src/main/resources/messages.yml index 859b1376..a8ab31ce 100644 --- a/core/src/main/resources/messages.yml +++ b/core/src/main/resources/messages.yml @@ -48,7 +48,7 @@ not-premium-other: '&4Player is not in the premium list' # Admin wanted to change the premium of a user that isn't known to the plugin player-unknown: '&4Player not in the database' -# ========= Bukkit/Spigot/PaperSpigot/TacoSpigot only ================================ +# ========= Bukkit/Spigot ================ # The user skipped the authentication, because it was a premium player auto-login: '&2Auto logged in'