From 67bca0155299eb3965665d5ffbd186c973513bd6 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Sat, 25 Jul 2015 10:11:54 +0200 Subject: [PATCH 01/26] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6468c75d0..2e259e5b0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ - JavaDocs: AuthMe Javadoc -- Maven Repo: AuthMe Repo +- Maven Repo: AuthMe Repo #####Statistics: @@ -39,7 +39,7 @@ McStats: http://mcstats.org/plugin/AuthMe #####Running Requirements: >- Java 1.7 (should work also with Java 1.8) ->- Spigot or CraftBukkit +>- Spigot or CraftBukkit (1.7.10 or 1.8.X)
###Plugin Description: From ebe9a78cb53c7db244ce674d6667e66d26b869bd Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 25 Jul 2015 10:20:32 +0200 Subject: [PATCH 02/26] Updated prototype --- .../NewConfiguration/{forcedActions.yml => actions.yml} | 0 .../NewConfiguration/advanced.yml | 3 --- .../NewConfiguration/database.yml | 3 ++- .../NewConfiguration/{emailSystem.yml => email.yml} | 0 .../NewConfiguration/general.yml | 2 -- 5 files changed, 2 insertions(+), 6 deletions(-) rename PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/{forcedActions.yml => actions.yml} (100%) rename PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/{emailSystem.yml => email.yml} (100%) diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/forcedActions.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml similarity index 100% rename from PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/forcedActions.yml rename to PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml index 5493ecd69..a432ec9c3 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml @@ -17,9 +17,6 @@ sessionLogin: sessionExpireOnIpChange: true security: - # Should players in the OP list have every permissions? - opPermissions: true - # Online players aren't kicked out for "Logged in from another location!", this option should always be set to true! forceSingleSession: true # Should we display all other accounts from a player when he joins? diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml index 6a8855997..6c26091b4 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml @@ -1,7 +1,6 @@ # Database AuthMeReloaded configuration file # What type of database do you want to use? Avariable options: sqlite, mysql, redis -# (The old flatfile backend is now deprecated, if you set this option to 'file' the 'file to SQLite' converter will be executed!) backend: sqlite # Do you like to cache all the queries? (Performance Boost) caching: true @@ -12,6 +11,7 @@ databaseName: authme tableName: authme # MySql Database connection settings +# Avariable only if the AuthMeReloaded-Mysql module is installed! mysql: port: '3306' host: 127.0.0.1 @@ -19,6 +19,7 @@ mysql: password: '12345' # Redis Database connection settings +# Avariable only if the AuthMeReloaded-Redis module is installed! redis: # Get Redis from http://redis.io/ host: 127.0.0.1 diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/emailSystem.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml similarity index 100% rename from PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/emailSystem.yml rename to PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml index c1d290c2c..48931ea49 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml @@ -67,8 +67,6 @@ password: # When it's true, registration require that kind of command: # /register doublePasswordCheck: true - # Should players can use their usernames as passwords? - allowNameAsPassword: false # Deny unsafe passwords for being used, put them on lowercase! unsafePasswords: - '123456' From ba70b17394c94e1ba21da3f5be7fda1c4b960c7d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 26 Jul 2015 01:18:35 +0200 Subject: [PATCH 03/26] Updated team --- team.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/team.txt b/team.txt index c67b6f0c5..21b9cdb46 100644 --- a/team.txt +++ b/team.txt @@ -2,9 +2,10 @@ AuthMe-Team: Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author +Kloudy - Main developer Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor -Maxetto (maxetto) - Ticket Manager, Italian Translator, Basic Developer -Trojaner25 (Trojaner25) - Ticket manager, Basic Developer -irobin591 (irobin591) - DE Translator -WaterCXubic (WaterXCubic) - ZHHK Translator +Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor +Trojaner25 - Ticket manager, Basic Developer +irobin591 - DE Translator +WaterCXubic - ZHHK Translator Bodyash - Russian/Ukrainian translator From cd3e7b5d431fd54eaedfdc090083ebfca15cd598 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 27 Jul 2015 15:08:40 +0200 Subject: [PATCH 04/26] First attempt to fix the email registation issue --- .../register/ProcessSyncronousEmailRegister.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index e7510eae0..c0c9e3fd0 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -2,6 +2,7 @@ package fr.xephi.authme.process.register; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; @@ -34,11 +35,20 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; + + BukkitScheduler sched = plugin.getServer().getScheduler(); + +// if (time != 0) { +// LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); +// BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); +// LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); +// } + if (time != 0) { - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); - BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } + LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); From ba06bb514ac20c6481531c0c24b253f90640e075 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 27 Jul 2015 16:09:06 +0200 Subject: [PATCH 05/26] Revert "First attempt to fix the email registation issue" This reverts commit cd3e7b5d431fd54eaedfdc090083ebfca15cd598. --- .../register/ProcessSyncronousEmailRegister.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index c0c9e3fd0..e7510eae0 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -2,7 +2,6 @@ package fr.xephi.authme.process.register; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; @@ -35,20 +34,11 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; - - BukkitScheduler sched = plugin.getServer().getScheduler(); - -// if (time != 0) { -// LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); -// BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); -// LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); -// } - if (time != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); + BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); From 5388f081174f30cf467d5c43f0a554c6adf97afe Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 00:04:16 +0200 Subject: [PATCH 06/26] Allow session timeout = 0 (with warnings) --- src/main/java/fr/xephi/authme/AuthMe.java | 4 +++ .../authme/process/quit/AsyncronousQuit.java | 26 ++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 45a6052ec..4937fcb1a 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -251,6 +251,10 @@ public class AuthMe extends JavaPlugin { if (!Settings.isForceSingleSessionEnabled) { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } + + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled){ + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + } if (Settings.reloadSupport) try { diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 4c833d66b..e60d9719e 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -78,18 +78,20 @@ public class AsyncronousQuit { LimboCache.getInstance().deleteLimboPlayer(name); } if (Settings.isSessionsEnabled && !isKick) { - BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - PlayerCache.getInstance().removePlayer(name); - if (database.isLogged(name)) - database.setUnlogged(name); - plugin.sessions.remove(name); - } - - }, Settings.getSessionTimeout * 20 * 60); - plugin.sessions.put(name, task); + if (Settings.getSessionTimeout != 0){ + BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + PlayerCache.getInstance().removePlayer(name); + if (database.isLogged(name)) + database.setUnlogged(name); + plugin.sessions.remove(name); + } + + }, Settings.getSessionTimeout * 20 * 60); + plugin.sessions.put(name, task); + } } else { PlayerCache.getInstance().removePlayer(name); database.setUnlogged(name); From 79e65742322b6e4841708d23738dcc2f4302d2a0 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 00:40:25 +0200 Subject: [PATCH 07/26] Separate message for antibot kick --- .../xephi/authme/listener/AuthMePlayerListener.java | 10 +++++++++- src/main/java/fr/xephi/authme/settings/Settings.java | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 03beb3b6b..5ce3148e1 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -428,13 +428,21 @@ public class AuthMePlayerListener implements Listener { } } - if (Settings.isKickNonRegisteredEnabled) { + if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction){ if (!plugin.database.isAuthAvailable(name)) { event.setKickMessage(m.send("reg_only")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } + + if (Settings.antiBotInAction){ + if (!plugin.database.isAuthAvailable(name)) { + event.setKickMessage(m.send("AntiBot service in action! Non registered players can't connect until the bot attack stops!")[0]); //Need to add string to messages + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + return; + } + } // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 12b4c6652..6f513f608 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -22,6 +22,9 @@ import fr.xephi.authme.security.HashAlgorithm; public final class Settings extends YamlConfiguration { + //This is not an option! + public static Boolean antiBotInAction = false; + public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; @@ -606,9 +609,13 @@ public final class Settings extends YamlConfiguration { } public static void switchAntiBotMod(boolean mode) { - if (mode) + if (mode){ isKickNonRegisteredEnabled = true; - else isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + antiBotInAction = true; + }else{ + isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + antiBotInAction = false; + } } private static void getWelcomeMessage() { From 90d8fc85487d7103053ee528b3aa27d326df5d02 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 01:15:00 +0200 Subject: [PATCH 08/26] Second attempt to fix email registration --- .../register/ProcessSyncronousEmailRegister.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index e7510eae0..a7a8ab88a 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -1,7 +1,7 @@ package fr.xephi.authme.process.register; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; @@ -34,15 +34,17 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; + + BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0) { LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); - BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); - BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); + BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); + player.saveData(); if (!Settings.noConsoleSpam) ConsoleLogger.info(player.getName() + " registered " + plugin.getIP(player)); From f80017de6746bcd985dfa773edf7a6d1e8328dc4 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 01:26:04 +0200 Subject: [PATCH 09/26] Fixed xD --- .../process/register/ProcessSyncronousEmailRegister.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index a7a8ab88a..ede70c189 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -37,11 +37,13 @@ public class ProcessSyncronousEmailRegister implements Runnable { BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0) { - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); + if (LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId() != null) + LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); + if (LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId() != null) + LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); From c4f516582c806d1271e7b960d07828af692764a4 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 01:39:58 +0200 Subject: [PATCH 10/26] Ok, go away stupid checks! --- .../process/register/ProcessSyncronousEmailRegister.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index ede70c189..d2b25414d 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -37,13 +37,9 @@ public class ProcessSyncronousEmailRegister implements Runnable { BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0) { - if (LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId() != null) - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); } - if (LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId() != null) - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); From 223fff4b52c06d2105c34bd099db53e1408dafd5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 02:11:58 +0200 Subject: [PATCH 11/26] New attempt to fix the broken email registration -_- --- .../register/ProcessSyncronousEmailRegister.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index d2b25414d..2ba9f63d4 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -8,6 +8,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; @@ -28,6 +29,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { @Override public void run() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (!Settings.getRegisteredGroup.isEmpty()) { Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); } @@ -36,12 +38,16 @@ public class ProcessSyncronousEmailRegister implements Runnable { int msgInterval = Settings.getWarnMessageInterval; BukkitScheduler sched = plugin.getServer().getScheduler(); - if (time != 0) { + if (time != 0 && limbo != null) { + limbo.getTimeoutTaskId().cancel(); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + limbo.setTimeoutTaskId(id); + } + if (limbo != null){ + limbo.getMessageTaskId().cancel(); + BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); + limbo.setMessageTaskId(nwMsg); } - BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); player.saveData(); if (!Settings.noConsoleSpam) From 47211ab803fc2bbda6f5b4cd52209615fc784f9c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 02:57:50 +0200 Subject: [PATCH 12/26] Code cleanup --- src/main/java/fr/xephi/authme/Utils.java | 12 ++++++++++++ .../java/fr/xephi/authme/cache/backup/FileCache.java | 11 ++--------- .../xephi/authme/process/join/AsyncronousJoin.java | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 15e01fe22..cadac9eb8 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,5 +1,6 @@ package fr.xephi.authme; +import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -208,5 +209,16 @@ public class Utils { NOTLOGGEDIN, LOGGEDIN } + + public static void purgeDirectory(File dir) { + if (dir != null && dir.listFiles() != null) + for (File file : dir.listFiles()) { + if (file != null){ + if (file.isDirectory()) + purgeDirectory(file); + file.delete(); + } + } + } } diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 11fce587c..948b0b079 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -24,6 +24,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.api.API; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.Utils; public class FileCache { @@ -547,15 +548,7 @@ public class FileCache { } if (file.exists()) { if (file.isDirectory() && file.listFiles() != null) { - for (File f : file.listFiles()) { - if (f.isDirectory() && f.listFiles() != null) { - for (File a : f.listFiles()) { - a.delete(); - } - f.delete(); - } else f.delete(); - } - file.delete(); + Utils.purgeDirectory(file); } else file.delete(); } } catch (Exception e) { diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 7e5101d0b..2e72bde46 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -141,7 +141,7 @@ public class AsyncronousJoin { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null) { + if (player.isOnline() && tpEvent.getTo() != null) { if (tpEvent.getTo().getWorld() != null) player.teleport(tpEvent.getTo()); } @@ -185,7 +185,7 @@ public class AsyncronousJoin { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null) { + if (player.isOnline() && tpEvent.getTo() != null) { if (tpEvent.getTo().getWorld() != null) player.teleport(tpEvent.getTo()); } @@ -291,7 +291,7 @@ public class AsyncronousJoin { FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { + if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { player.teleport(tpEvent.getTo()); } } From 88530542ace896bdd75c084030245f4ff6ff6807 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 17:06:54 +0200 Subject: [PATCH 13/26] Fixes --- src/main/java/fr/xephi/authme/Utils.java | 21 ++++++----- .../xephi/authme/cache/backup/FileCache.java | 35 ++++++++++--------- .../authme/listener/AuthMePlayerListener.java | 2 +- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index cadac9eb8..ee20c5784 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -210,15 +210,18 @@ public class Utils { LOGGEDIN } - public static void purgeDirectory(File dir) { - if (dir != null && dir.listFiles() != null) - for (File file : dir.listFiles()) { - if (file != null){ - if (file.isDirectory()) - purgeDirectory(file); - file.delete(); - } + public static void purgeDirectory(File file){ + String files[] = file.list(); + if (files != null && files.length != 0){ + for (String temp : files) { + File fileDelete = new File(file, temp); + if (fileDelete.isDirectory()){ + purgeDirectory(fileDelete); + fileDelete.delete(); + } else { + fileDelete.delete(); + } + } } } - } diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 948b0b079..b18ad9c16 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -45,9 +45,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -198,9 +198,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } try { File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -537,22 +537,25 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } try { File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path); - if (!file.exists()) { - file = new File("cache/" + player.getName().toLowerCase() + ".cache"); - } - if (file.exists()) { - if (file.isDirectory() && file.listFiles() != null) { - Utils.purgeDirectory(file); - } else file.delete(); + if (file.list() != null) { + Utils.purgeDirectory(file); + file.delete(); + } else { + file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + player.getName().toLowerCase() + ".cache"); + if(file.isFile()){ + file.delete(); + } else { + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache, it doesn't exist!"); + } } } catch (Exception e) { - ConsoleLogger.showError("File cannot be removed correctly :/"); + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache :/"); } } @@ -561,9 +564,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); if (!file.exists()) { diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 5ce3148e1..2fff82fd5 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -438,7 +438,7 @@ public class AuthMePlayerListener implements Listener { if (Settings.antiBotInAction){ if (!plugin.database.isAuthAvailable(name)) { - event.setKickMessage(m.send("AntiBot service in action! Non registered players can't connect until the bot attack stops!")[0]); //Need to add string to messages + event.setKickMessage("AntiBot service in action! Non registered players can't connect until the bot attack stops!"); //Need to add string to messages event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } From 311d551653f8cb5eb01efd970b07c86dc76f5b84 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 17:26:16 +0200 Subject: [PATCH 14/26] Update pom --- pom.xml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 913e8b36e..6e16eb03e 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ mysql mysql-connector-java 5.1.36 + compile @@ -185,13 +186,15 @@ org.xerial sqlite-jdbc 3.8.10.1 + compile - com.sun.mail - javax.mail + javax.mail + javax.mail-api 1.5.4 + compile @@ -199,6 +202,7 @@ com.maxmind.geoip geoip-api 1.2.14 + compile @@ -224,6 +228,7 @@ org.spigotmc spigot-api ${bukkitVersion} + provided bungeecord-chat @@ -237,6 +242,7 @@ com.comphenix.attribute AttributeStorage 0.0.2-SNAPSHOT + compile org.bukkit @@ -272,6 +278,7 @@ net.citizensnpcs citizensapi 2.0.16-SNAPSHOT + provided org.bukkit @@ -290,7 +297,7 @@ Multiverse-Core 2.5 jar - compile + provided org.bukkit @@ -320,6 +327,7 @@ net.ess3 Essentials 2.14-SNAPSHOT + provided org.bukkit @@ -337,6 +345,7 @@ net.minelink CombatTagPlus 1.2.1-SNAPSHOT + provided org.bukkit @@ -410,6 +419,7 @@ com.trc202 CombatTag 6.2.1-SNAPSHOT + provided org.bukkit @@ -427,6 +437,7 @@ de.luricos.bukkit xAuth 2.6 + provided org.bukkit @@ -464,6 +475,7 @@ com.acrobot.chestshop chestshop 3.8.12 + provided org.bukkit From b0d9fdc9789c187e7486de91e82fc85b1a3fedb6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 28 Jul 2015 18:36:12 +0200 Subject: [PATCH 15/26] code style --- .../authme/process/register/ProcessSyncronousEmailRegister.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index 2ba9f63d4..96a200c23 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -36,7 +36,7 @@ public class ProcessSyncronousEmailRegister implements Runnable { m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; - + BukkitScheduler sched = plugin.getServer().getScheduler(); if (time != 0 && limbo != null) { limbo.getTimeoutTaskId().cancel(); From 434b37b55f6dd6b288104fa84061ffcd353a9773 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:22:36 +0200 Subject: [PATCH 16/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e259e5b0..41fdfc5bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From 56f037bb4c620bfd047116c23971c4b037dc03d0 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:23:31 +0200 Subject: [PATCH 17/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41fdfc5bd..9bcc8c9fa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From 32b0d5887643fa4b2c69365381457bbb29f6ec05 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:39:56 +0200 Subject: [PATCH 18/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bcc8c9fa..38262070c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From e9078a9fab8c8056faa4901347e040359c451f79 Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:40:38 +0200 Subject: [PATCH 19/26] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 38262070c..28209ac67 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -

The most used authentication plugin for CraftBukkit/Spigot!


From 41d87a9e06fd4edf8adaa0a204b89dc76359dcfd Mon Sep 17 00:00:00 2001 From: "Gabriele C." Date: Wed, 29 Jul 2015 01:53:35 +0200 Subject: [PATCH 20/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28209ac67..8bad86615 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: From 79759bf139b42a41122db70fa46d72275224dea6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 14:12:01 +0200 Subject: [PATCH 21/26] Removed Passpartu feature --- README.md | 2 +- src/main/java/fr/xephi/authme/AuthMe.java | 2 - src/main/java/fr/xephi/authme/Utils.java | 38 -------------- .../xephi/authme/commands/AdminCommand.java | 15 ------ .../authme/commands/PasspartuCommand.java | 52 ------------------- .../authme/listener/AuthMePlayerListener.java | 4 +- .../fr/xephi/authme/settings/Settings.java | 13 +++-- src/main/resources/config.yml | 8 --- src/main/resources/plugin.yml | 9 +--- 9 files changed, 13 insertions(+), 130 deletions(-) delete mode 100644 src/main/java/fr/xephi/authme/commands/PasspartuCommand.java diff --git a/README.md b/README.md index 8bad86615..12216e738 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ typing commands or use the inventory. It can also kick players with uncommon lon
  • Username spoofing protection.
  • Countries Whitelist/Blacklist! (countries codes)
  • Built-in AntiBot System!
  • -
  • Passpartu Feature: Admin can login with all account more info here (Deprecated)
  • +
  • ForceLogin Feature: Admins can login with all account via console command!
  • Avoid the "Logged in from another location" message!
  • Session Login!
  • Editable translations and messages!
  • diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 4937fcb1a..fc719c3f5 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -49,7 +49,6 @@ import fr.xephi.authme.commands.ConverterCommand; import fr.xephi.authme.commands.EmailCommand; import fr.xephi.authme.commands.LoginCommand; import fr.xephi.authme.commands.LogoutCommand; -import fr.xephi.authme.commands.PasspartuCommand; import fr.xephi.authme.commands.RegisterCommand; import fr.xephi.authme.commands.UnregisterCommand; import fr.xephi.authme.converter.Converter; @@ -243,7 +242,6 @@ public class AuthMe extends JavaPlugin { this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); this.getCommand("logout").setExecutor(new LogoutCommand(this)); this.getCommand("unregister").setExecutor(new UnregisterCommand(this)); - this.getCommand("passpartu").setExecutor(new PasspartuCommand(this)); this.getCommand("email").setExecutor(new EmailCommand(this)); this.getCommand("captcha").setExecutor(new CaptchaCommand(this)); this.getCommand("converter").setExecutor(new ConverterCommand(this)); diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index ee20c5784..c19754868 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,9 +1,7 @@ package fr.xephi.authme; import java.io.File; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -14,7 +12,6 @@ import org.bukkit.entity.Player; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.events.AuthMeTeleportEvent; -import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; public class Utils { @@ -23,7 +20,6 @@ public class Utils { private static Utils singleton; int id; public AuthMe plugin; - private static List tokens = new ArrayList(); public Utils(AuthMe plugin) { this.plugin = plugin; @@ -161,40 +157,6 @@ public class Utils { }); } - /* - * Random Token for passpartu - */ - public boolean obtainToken() { - try { - final String token = new RandomString(10).nextString(); - tokens.add(token); - ConsoleLogger.info("[AuthMe] Security passpartu token: " + token); - Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - tokens.remove(token); - } - - }, 600); - return true; - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - /* - * Read Token - */ - public boolean readToken(String inputToken) { - boolean ret = false; - if (tokens.contains(inputToken)) - ret = true; - tokens.remove(inputToken); - return (ret); - } - /* * Used for force player GameMode */ diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 1f6a15efe..10a4e950e 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -15,7 +15,6 @@ import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -71,7 +70,6 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("/authme firstspawn - Teleport yourself to the first spawn point"); sender.sendMessage("/authme switchantibot on/off - Enable/Disable AntiBot feature"); sender.sendMessage("/authme forcelogin - Enforce the login of a connected player"); - sender.sendMessage("/authme passpartutoken - Generate a timed token to login with every player's account (CONSOLE ONLY)"); return true; } @@ -80,19 +78,6 @@ public class AdminCommand implements CommandExecutor { return true; } - if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) { - if (args.length > 1) { - ConsoleLogger.info("[AuthMe] command usage: /authme passpartutoken"); - return true; - } - if (Utils.getInstance().obtainToken()) { - ConsoleLogger.info("[AuthMe] You have 30s to insert this token ingame with /passpartu "); - } else { - ConsoleLogger.info("[AuthMe] Security error on passpartu token, please redo the command."); - } - return true; - } - if (args[0].equalsIgnoreCase("version")) { sender.sendMessage("AuthMe Version: " + AuthMe.getInstance().getDescription().getVersion()); return true; diff --git a/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java b/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java deleted file mode 100644 index 0d7b059e9..000000000 --- a/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Messages; - -/** - * - * @author stefano - */ -public class PasspartuCommand implements CommandExecutor { - - private Utils utils = Utils.getInstance(); - public AuthMe plugin; - private Messages m = Messages.getInstance(); - - public PasspartuCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - if (PlayerCache.getInstance().isAuthenticated(sender.getName().toLowerCase())) { - return true; - } - - if ((sender instanceof Player) && args.length == 1) { - if (utils.readToken(args[0])) { - // bypass login! - plugin.management.performLogin((Player) sender, "dontneed", true); - return true; - } - sender.sendMessage("Time is expired or Token is Wrong!"); - return true; - } - sender.sendMessage("usage: /passpartu token"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 2fff82fd5..7f7c19c6f 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -84,7 +84,7 @@ public class AuthMePlayerListener implements Listener { return; String cmd = msg.split(" ")[0]; - if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/passpartu") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) + if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) return; if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd")) return; @@ -411,7 +411,7 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return; - if (Settings.enablePasspartu && !Settings.countriesBlacklist.isEmpty()) { + if (!Settings.countriesBlacklist.isEmpty()) { String code = plugin.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || (Settings.countriesBlacklist.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { event.setKickMessage(m.send("country_banned")[0]); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 6f513f608..6fc1aca6f 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -62,7 +62,7 @@ public final class Settings extends YamlConfiguration { isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled, getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, - isBackupOnStart, isBackupOnStop, enablePasspartu, isStopEnabled, + isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, useCaptcha, emailRegistration, multiverse, chestshop, bungee, banUnsafeIp, doubleEmailCheck, @@ -187,7 +187,6 @@ public final class Settings extends YamlConfiguration { isBackupOnStart = configFile.getBoolean("BackupSystem.OnServerStart", false); isBackupOnStop = configFile.getBoolean("BackupSystem.OnServeStop", false); backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); - enablePasspartu = configFile.getBoolean("Passpartu.enablePasspartu", false); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); allowCommands = (List) configFile.getList("settings.restrictions.allowCommands"); @@ -200,8 +199,6 @@ public final class Settings extends YamlConfiguration { allowCommands.add("/l"); if (!allowCommands.contains("/reg")) allowCommands.add("/reg"); - if (!allowCommands.contains("/passpartu")) - allowCommands.add("/passpartu"); if (!allowCommands.contains("/email")) allowCommands.add("/email"); if (!allowCommands.contains("/captcha")) @@ -420,8 +417,16 @@ public final class Settings extends YamlConfiguration { } if (contains("Performances.useMultiThreading")) set("Performances.useMultiThreading", null); + if (contains("Performances")) set("Performances", null); + + if (contains("Passpartu.enablePasspartu")) + set("Passpartu.enablePasspartu", null); + + if (contains("Passpartu")) + set("Passpartu", null); + if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); changes = true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0475c055c..b98ce8514 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -84,7 +84,6 @@ settings: - /register - /l - /reg - - /passpartu - /email - /captcha # Maximum Registration per IP default: 1 @@ -305,13 +304,6 @@ BackupSystem: OnServerStop: true # Windows only mysql installation Path MysqlWindowsPath: 'C:\\Program Files\\MySQL\\MySQL Server 5.1\\' -Passpartu: - # Enable or Disable Passpartu Feature, - # this feature let Admin Login with all registered - # Account they need, for example inspecting Player that - # is doing shit, they can login without know any - # Player password! More info on How TO - enablePasspartu: false Security: SQLProblem: # Stop the server if we can't contact the sql database diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c0bd7fb44..5028d2550 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -22,10 +22,7 @@ commands: usage: /logout unregister: description: unregister your account - usage: /unregister password - passpartu: - description: compare passpartu token - usage: /passpartu token + usage: /unregister password authme: description: AuthMe op commands usage: '/authme reload|register playername password|changepassword playername password|unregister playername|version' @@ -48,7 +45,6 @@ permissions: authme.changepassword: true authme.logout: true authme.unregister: true - authme.passpartu: true authme.l: true authme.reg: true authme.email: true @@ -87,9 +83,6 @@ permissions: authme.email: description: Email default: true - authme.passpartu: - description: passpartu - default: true authme.allow2accounts: description: allow more accounts for same ip default: false From a06f3de35a6a8874b44b6e9579c3b239a522aeda Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 14:49:14 +0200 Subject: [PATCH 22/26] Fixed autopurge with UUIDS --- src/main/java/fr/xephi/authme/AuthMe.java | 14 +++++++------- src/main/java/fr/xephi/authme/DataManager.java | 13 +++++++++++++ src/main/java/fr/xephi/authme/modules/Module.java | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index fc719c3f5..f320e5b5f 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -250,11 +250,11 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } - if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled){ + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); } - if (Settings.reloadSupport) + if (Settings.reloadSupport) { try { int playersOnline = 0; try { @@ -279,9 +279,9 @@ public class AuthMe extends JavaPlugin { } } catch (Exception ex) { } + } - if (Settings.usePurge) - autoPurge(); + autoPurge(); // Download GeoIp.dat file downloadGeoIp(); @@ -545,13 +545,13 @@ public class AuthMe extends JavaPlugin { return; ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); + dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); + dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC if (Settings.purgeLimitedCreative) dataManager.purgeLimitedCreative(cleared); if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) if (Settings.purgePermissions) dataManager.purgePermissions(cleared, permission); } diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 2bcfa17aa..072d97416 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -109,6 +109,12 @@ public class DataManager { if (playerFile.exists()) { playerFile.delete(); i++; + } else { + playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } } } catch (Exception e) { } @@ -116,6 +122,7 @@ public class DataManager { ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files"); } + @SuppressWarnings("deprecation") public void purgeEssentials(List cleared) { int i = 0; for (String name : cleared) { @@ -124,6 +131,12 @@ public class DataManager { if (playerFile.exists()) { playerFile.delete(); i++; + } else { + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } } } catch (Exception e) { } diff --git a/src/main/java/fr/xephi/authme/modules/Module.java b/src/main/java/fr/xephi/authme/modules/Module.java index 779beb65e..6011097af 100644 --- a/src/main/java/fr/xephi/authme/modules/Module.java +++ b/src/main/java/fr/xephi/authme/modules/Module.java @@ -13,6 +13,7 @@ public interface Module { public enum ModuleType { MANAGER, MYSQL, + REDIS, ACTIONS, CONVERTERS, EMAILS, From f016d682c51b6796314c29e23b9db2b8240fab63 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 15:33:19 +0200 Subject: [PATCH 23/26] Updated to SpigotApi 1.8.8 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6e16eb03e..bacc97b2d 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.7 - 1.8.7-R0.1-SNAPSHOT + 1.8.8-R0.1-SNAPSHOT From b8a22409828db7b1c4e40cbefd966a675744a864 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 18:44:06 +0200 Subject: [PATCH 24/26] Add error message if unable to generate img --- .../java/fr/xephi/authme/SendMailSSL.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 40056e337..54d2068a0 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -82,14 +82,18 @@ public class SendMailSSL { // Generate an image ? File file = null; if (Settings.generateImage) { - ImageGenerator gen = new ImageGenerator(newPass); - file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); - ImageIO.write(gen.generateImage(), "jpg", file); - messageBodyPart = new MimeBodyPart(); - DataSource source = new FileDataSource(file); - messageBodyPart.setDataHandler(new DataHandler(source)); - messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); - multipart.addBodyPart(messageBodyPart); + try { + ImageGenerator gen = new ImageGenerator(newPass); + file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); + ImageIO.write(gen.generateImage(), "jpg", file); + messageBodyPart = new MimeBodyPart(); + DataSource source = new FileDataSource(file); + messageBodyPart.setDataHandler(new DataHandler(source)); + messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); + multipart.addBodyPart(messageBodyPart); + } catch (Exception e) { + ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); + } } message.setContent(multipart); From 949ebc03bbdeaca53de3f50739a9fe8e565da595 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 29 Jul 2015 21:48:59 +0200 Subject: [PATCH 25/26] Fixed mail API --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bacc97b2d..316384fb9 100644 --- a/pom.xml +++ b/pom.xml @@ -191,12 +191,13 @@ - javax.mail - javax.mail-api + com.sun.mail + javax.mail 1.5.4 compile + com.maxmind.geoip From 7bfab781a1ab401df24aae09bcc64175e2fb0e69 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Jul 2015 00:47:19 +0200 Subject: [PATCH 26/26] More error messages! --- .../java/fr/xephi/authme/SendMailSSL.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 54d2068a0..d7681ade8 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -95,16 +95,27 @@ public class SendMailSSL { ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); } } - - message.setContent(multipart); + Transport transport = session.getTransport("smtp"); - transport.connect(smtp, acc, password); + message.setContent(multipart); + + try { + transport.connect(smtp, acc, password); + } catch (Exception e) { + ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recorvery email to " + mail); + if (file != null) + file.delete(); + return; + } transport.sendMessage(message, message.getAllRecipients()); + if (file != null) file.delete(); + } catch (RuntimeException e) { + ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); } catch (Exception e) { - ConsoleLogger.showError("Some error occured while trying to send a mail to " + mail); + ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); } }