From c61345fd4386632525e0b8e1859d41c66566c642 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 00:32:14 +0100 Subject: [PATCH 01/10] cleanup + fix test crypts test on windows systems --- pom.xml | 25 +++++++++++++------ .../process/login/ProcessSyncPlayerLogin.java | 2 -- .../fr/xephi/authme/settings/Settings.java | 2 -- .../java/fr/xephi/authme/util/Profiler.java | 4 +-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index f913596be..07150f082 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,9 @@ + UTF-8 + UTF-8 AuthMe @@ -57,9 +59,6 @@ Xephi, sgdc3, DNx5, timvisee, games647, ljacqu Unknown - - 1.7 - 1.9-pre1-SNAPSHOT @@ -147,14 +146,26 @@ - + org.apache.maven.plugins maven-compiler-plugin 3.5.1 - 1.7 - ${javaVersion} + 1.8 + 1.8 + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.15 + + -Dfile.encoding=UTF-8 @@ -717,7 +728,7 @@ net.minelink CombatTagPlus - 1.2.1-SNAPSHOT + 1.2.2-SNAPSHOT provided diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java index 0c120b52b..78995cb1c 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java @@ -38,7 +38,6 @@ public class ProcessSyncPlayerLogin implements Runnable { private final String name; private final PlayerAuth auth; private final AuthMe plugin; - private final DataSource database; private final PluginManager pm; private final JsonCache playerCache; private final NewSetting settings; @@ -54,7 +53,6 @@ public class ProcessSyncPlayerLogin implements Runnable { public ProcessSyncPlayerLogin(Player player, AuthMe plugin, DataSource database, NewSetting settings) { this.plugin = plugin; - this.database = database; this.pm = plugin.getServer().getPluginManager(); this.player = player; this.name = player.getName().toLowerCase(); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index c53869c0f..839e37378 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -84,7 +84,6 @@ public final class Settings { getMaxJoinPerIp; protected static FileConfiguration configFile; private static AuthMe plugin; - private static Settings instance; /** * Constructor for Settings. @@ -92,7 +91,6 @@ public final class Settings { * @param pl AuthMe */ public Settings(AuthMe pl) { - instance = this; plugin = pl; configFile = plugin.getConfig(); loadVariables(); diff --git a/src/main/java/fr/xephi/authme/util/Profiler.java b/src/main/java/fr/xephi/authme/util/Profiler.java index 0784aa653..73bdf5e45 100644 --- a/src/main/java/fr/xephi/authme/util/Profiler.java +++ b/src/main/java/fr/xephi/authme/util/Profiler.java @@ -2,15 +2,13 @@ package fr.xephi.authme.util; import java.text.DecimalFormat; -/** - */ -@SuppressWarnings("UnusedDeclaration") public class Profiler { /** * Defines the past time in milliseconds. */ private long time = 0; + /** * Defines the time in milliseconds the profiler last started at. */ From e88b4eda53ba61b7f4b1dd422598687e42d485a6 Mon Sep 17 00:00:00 2001 From: Xephi59 Date: Sun, 28 Feb 2016 00:36:06 +0100 Subject: [PATCH 02/10] Add %acc_nb tag to max_reg message - Fix #570 --- .../java/fr/xephi/authme/output/MessageKey.java | 2 +- .../authme/process/register/AsyncRegister.java | 15 +++++++++------ src/main/resources/messages/messages_en.yml | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/xephi/authme/output/MessageKey.java b/src/main/java/fr/xephi/authme/output/MessageKey.java index 45cdc0bef..0c96b6667 100644 --- a/src/main/java/fr/xephi/authme/output/MessageKey.java +++ b/src/main/java/fr/xephi/authme/output/MessageKey.java @@ -41,7 +41,7 @@ public enum MessageKey { REGISTER_EMAIL_MESSAGE("reg_email_msg"), - MAX_REGISTER_EXCEEDED("max_reg"), + MAX_REGISTER_EXCEEDED("max_reg", "%acc_nb"), USAGE_REGISTER("usage_reg"), diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java index e17c511da..97344ba04 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -1,5 +1,8 @@ package fr.xephi.authme.process.register; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + import fr.xephi.authme.AuthMe; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; @@ -13,8 +16,6 @@ import fr.xephi.authme.security.crypts.TwoFactor; import fr.xephi.authme.settings.NewSetting; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; /** */ @@ -71,6 +72,7 @@ public class AsyncRegister { } //check this in both possiblities so don't use 'else if' + Integer size = 0; if (database.isAuthAvailable(name)) { m.send(player, MessageKey.NAME_ALREADY_REGISTERED); return false; @@ -78,8 +80,8 @@ public class AsyncRegister { && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS) && !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("localhost") - && database.getAllAuthsByIp(ip).size() >= Settings.getmaxRegPerIp) { - m.send(player, MessageKey.MAX_REGISTER_EXCEEDED); + && (size = database.getAllAuthsByIp(ip).size()) >= Settings.getmaxRegPerIp) { + m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, size.toString()); return false; } return true; @@ -96,10 +98,11 @@ public class AsyncRegister { } private void emailRegister() { + Integer size = 0; if (Settings.getmaxRegPerEmail > 0 && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS) - && database.countAuthsByEmail(email) >= Settings.getmaxRegPerEmail) { - m.send(player, MessageKey.MAX_REGISTER_EXCEEDED); + && (size = database.countAuthsByEmail(email)) >= Settings.getmaxRegPerEmail) { + m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, size.toString()); return; } final HashedPassword hashedPassword = plugin.getPasswordSecurity().computeHash(password, name); diff --git a/src/main/resources/messages/messages_en.yml b/src/main/resources/messages/messages_en.yml index 1b1ae61e4..4e155bcfe 100644 --- a/src/main/resources/messages/messages_en.yml +++ b/src/main/resources/messages/messages_en.yml @@ -12,7 +12,7 @@ login: '&2Successful login!' vb_nonActiv: '&cYour account isn''t activated yet, please check your emails!' user_regged: '&cYou already have registered this username!' usage_reg: '&cUsage: /register ' -max_reg: '&cYou have exceeded the maximum number of registrations for your connection!' +max_reg: '&cYou have exceeded the maximum number of registrations (%acc_nb) for your connection!' no_perm: '&4You don''t have the permission to perform this action!' error: '&4An unexpected error occurred, please contact an administrator!' login_msg: '&cPlease, login with the command "/login "' From a233b0e685fb3167fcfb37d91e7923990e8a4a10 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 00:37:29 +0100 Subject: [PATCH 03/10] Update circle.yml --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index dea5e80c1..80201e5e8 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: java: - version: oraclejdk7 + version: oraclejdk8 general: artifacts: - "target/AuthMe-*.jar" From 89256debc86a6b143db78931f9d2cbada1282e44 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 00:37:47 +0100 Subject: [PATCH 04/10] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1645036ea..3eab0c373 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ sudo: false language: java -jdk: oraclejdk7 +jdk: oraclejdk8 cache: directories: From 3c82a5a9361f4a26bff7954c30808f696f8d490d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 02:02:27 +0100 Subject: [PATCH 05/10] Fix test arguments --- pom.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 07150f082..b67f2b6a1 100644 --- a/pom.xml +++ b/pom.xml @@ -163,9 +163,11 @@ org.apache.maven.plugins maven-surefire-plugin - 2.15 + 2.19.1 - -Dfile.encoding=UTF-8 + 3 + true + ${argLine} -Xmx512M -Dfile.encoding=UTF-8 From a96a98e4edbcb0f03c108f0718d0b64ead6252d3 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 02:28:37 +0100 Subject: [PATCH 06/10] Speed up junit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b67f2b6a1..45d9d28bf 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ 3 true - ${argLine} -Xmx512M -Dfile.encoding=UTF-8 + ${argLine} -client -Xmx512M -Dfile.encoding=UTF-8 From cfdc99cfe64bb1aae26b4baf9c772631df63b0d1 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 03:04:43 +0100 Subject: [PATCH 07/10] Should fix mvn param --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45d9d28bf..39bb55670 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ 3 true - ${argLine} -client -Xmx512M -Dfile.encoding=UTF-8 + -client -Xmx512M -Dfile.encoding=UTF-8 ${argLine} From aaf17e6272975758a1e9cf3d286903d9a9b96dda Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 03:14:36 +0100 Subject: [PATCH 08/10] Damn mvn args --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 39bb55670..50a8fbfe3 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ 3 true - -client -Xmx512M -Dfile.encoding=UTF-8 ${argLine} + -Xmx512M -Dfile.encoding=UTF-8 ${argLine} From 90a0202b49eb1296ee468710adfdbc5b5b1162c0 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 28 Feb 2016 03:21:07 +0100 Subject: [PATCH 09/10] Fixed, finally! Was a jenkins side issue! --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 50a8fbfe3..39bb55670 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ 3 true - -Xmx512M -Dfile.encoding=UTF-8 ${argLine} + -client -Xmx512M -Dfile.encoding=UTF-8 ${argLine} From 8832c1ac0f4250bce97ad78886f11e113ab7af95 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 28 Feb 2016 09:05:30 +0100 Subject: [PATCH 10/10] Reduce output of resource closing tests --- .../xephi/authme/datasource/AbstractResourceClosingTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java b/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java index 5b215a908..f5ba58e85 100644 --- a/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java +++ b/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java @@ -167,7 +167,9 @@ public abstract class AbstractResourceClosingTest { * Verify that all AutoCloseables that have been created during the method execution have been closed. */ private void verifyHaveMocksBeenClosed() { - System.out.println("Found " + closeables.size() + " resources"); + if (closeables.isEmpty()) { + System.out.println("Note: detected no AutoCloseables for method '" + method.getName() + "'"); + } try { for (AutoCloseable autoCloseable : closeables) { verify(autoCloseable).close();