From 0aa6f753be5c9f9d0167860745064ac19e545edc Mon Sep 17 00:00:00 2001 From: games647 Date: Tue, 19 Jan 2016 14:31:29 +0100 Subject: [PATCH 01/12] Set utf-8 encoding for MySQL connections Fixes Xephi/AuthMeReloaded#458 --- src/main/java/fr/xephi/authme/datasource/MySQL.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 9e459ad71..3c48c6da0 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -110,6 +110,12 @@ public class MySQL implements DataSource { ds.addDataSourceProperty("cachePrepStmts", "true"); ds.addDataSourceProperty("prepStmtCacheSize", "250"); ds.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + + //set utf-8 as default encoding + ds.addDataSourceProperty("characterEncoding", "utf8"); + ds.addDataSourceProperty("encoding","UTF-8"); + ds.addDataSourceProperty("useUnicode", "true"); + ds.setUsername(this.username); ds.setPassword(this.password); ds.setInitializationFailFast(true); // Don't start the plugin if the database is unavailable From 3c88482e22e350960e33a3ac1e6e920a781a4000 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 21 Jan 2016 16:12:39 +0100 Subject: [PATCH 02/12] Maven enhancements --- .floo | 3 - .flooignore | 123 ------------------ pom.xml | 59 ++------- .../xephi/authme/command/CommandMapper.java | 2 - .../authme/security/crypts/CRAZYCRYPT1.java | 5 - .../authme/security/PasswordSecurityTest.java | 2 - .../java/fr/xephi/authme/util/UtilsTest.java | 1 - 7 files changed, 8 insertions(+), 187 deletions(-) delete mode 100644 .floo delete mode 100644 .flooignore diff --git a/.floo b/.floo deleted file mode 100644 index b0f2c28e0..000000000 --- a/.floo +++ /dev/null @@ -1,3 +0,0 @@ -{ - "url": "https://floobits.com/AuthMe-Team/AuthMeReloaded" -} \ No newline at end of file diff --git a/.flooignore b/.flooignore deleted file mode 100644 index e9c355d00..000000000 --- a/.flooignore +++ /dev/null @@ -1,123 +0,0 @@ -### Java ### -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -#*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm - -*.iml - -## Directory-based project format: -.idea/ -# if you remove the above rule, at least ignore the following: - -# User-specific stuff: -# .idea/workspace.xml -# .idea/tasks.xml -# .idea/dictionaries - -# Sensitive or high-churn files: -# .idea/dataSources.ids -# .idea/dataSources.xml -# .idea/sqlDataSources.xml -# .idea/dynamic.xml -# .idea/uiDesigner.xml - -# Gradle: -# .idea/gradle.xml -# .idea/libraries - -# Mongo Explorer plugin: -# .idea/mongoSettings.xml - -## File-based project format: -*.ipr -*.iws - -## Plugin-specific files: - -# IntelliJ -/out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties - - -### Eclipse ### -*.pydevproject -.metadata -.gradle -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath - -# Eclipse Core -.project - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# JDT-specific (Eclipse Java Development Tools) -.classpath - -# PDT-specific -.buildpath - -# sbteclipse plugin -.target - -# TeXlipse plugin -.texlipse - - -### Maven ### -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties - - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -nbactions.xml -nb-configuration.xml -.nb-gradle/ diff --git a/pom.xml b/pom.xml index 7e8cd70ba..33743bb12 100644 --- a/pom.xml +++ b/pom.xml @@ -125,39 +125,6 @@ - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.codehaus.mojo - buildnumber-maven-plugin - [1.0,) - - create-timestamp - - - - - true - true - - - - - - - - - - org.apache.maven.plugins @@ -169,24 +136,6 @@ - - org.codehaus.mojo - buildnumber-maven-plugin - 1.4 - - dd-MM-yy_HH-mm - build.time - - - - generate-resources - - create-timestamp - - - - - org.apache.maven.plugins @@ -263,6 +212,14 @@ UTF-8 true + + + attach-javadocs + + jar + + + diff --git a/src/main/java/fr/xephi/authme/command/CommandMapper.java b/src/main/java/fr/xephi/authme/command/CommandMapper.java index 8bc5dccdd..e43ee4bb1 100644 --- a/src/main/java/fr/xephi/authme/command/CommandMapper.java +++ b/src/main/java/fr/xephi/authme/command/CommandMapper.java @@ -1,8 +1,6 @@ package fr.xephi.authme.command; import fr.xephi.authme.command.executable.HelpCommand; -import fr.xephi.authme.command.help.HelpProvider; -import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.util.CollectionUtils; import fr.xephi.authme.util.StringUtils; diff --git a/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java b/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java index cd8af9249..828a38d8c 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java @@ -2,11 +2,6 @@ package fr.xephi.authme.security.crypts; import fr.xephi.authme.security.HashUtils; import fr.xephi.authme.security.MessageDigestAlgorithm; -import fr.xephi.authme.security.crypts.description.Usage; -import fr.xephi.authme.security.crypts.description.Recommendation; -import fr.xephi.authme.security.crypts.description.SaltType; -import fr.xephi.authme.security.crypts.description.HasSalt; - import java.nio.charset.Charset; import java.security.MessageDigest; diff --git a/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java b/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java index cf15eb5f9..81fdebea3 100644 --- a/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java +++ b/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java @@ -11,7 +11,6 @@ import fr.xephi.authme.util.WrapperMock; import org.bukkit.event.Event; import org.bukkit.plugin.PluginManager; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; @@ -25,7 +24,6 @@ import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; diff --git a/src/test/java/fr/xephi/authme/util/UtilsTest.java b/src/test/java/fr/xephi/authme/util/UtilsTest.java index 40769ae53..7bfac16ca 100644 --- a/src/test/java/fr/xephi/authme/util/UtilsTest.java +++ b/src/test/java/fr/xephi/authme/util/UtilsTest.java @@ -93,7 +93,6 @@ public class UtilsTest { } // Note: This method is used through reflections - @SuppressWarnings("unused") public static Player[] onlinePlayersImpl() { return new Player[]{ mock(Player.class), mock(Player.class) From 726861a2a1824b1052921330076c18221e9be8e1 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sat, 23 Jan 2016 19:31:02 +0700 Subject: [PATCH 03/12] Set PlayerJoinEvent listener priority to lowest. --- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index f672250c7..2e365e932 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -185,7 +185,7 @@ public class AuthMePlayerListener implements Listener { } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); if (player == null) { From 00a625efd07ac52099cc65412f514c50b25b6eac Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 25 Jan 2016 18:31:22 +0100 Subject: [PATCH 04/12] Try to fix circle builds... --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 672011c2e..7de576c76 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: oraclejdk7 general: artifacts: - - "target/AuthMe-*.jar" + - "/home/ubuntu/AuthMeReloaded/target/AuthMe-*.jar" test: override: - mvn clean install -B From f480a25be77450d8aa874dff5c9400e53b2232d6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 25 Jan 2016 18:42:12 +0100 Subject: [PATCH 05/12] Please circle, please! --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 7de576c76..5431a78aa 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: oraclejdk7 general: artifacts: - - "/home/ubuntu/AuthMeReloaded/target/AuthMe-*.jar" + - "target/*.jar" test: override: - mvn clean install -B From f3a4776978a0b740fbb2d6a71807e5d4d5fdcc8b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 25 Jan 2016 18:48:53 +0100 Subject: [PATCH 06/12] Revert "Please circle, please!" This reverts commit f480a25be77450d8aa874dff5c9400e53b2232d6. --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 5431a78aa..7de576c76 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: oraclejdk7 general: artifacts: - - "target/*.jar" + - "/home/ubuntu/AuthMeReloaded/target/AuthMe-*.jar" test: override: - mvn clean install -B From a3f1084fd8b1f5e05521469f0b0b27fdd865104d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 25 Jan 2016 18:48:56 +0100 Subject: [PATCH 07/12] Revert "Try to fix circle builds..." This reverts commit 00a625efd07ac52099cc65412f514c50b25b6eac. --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 7de576c76..672011c2e 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: version: oraclejdk7 general: artifacts: - - "/home/ubuntu/AuthMeReloaded/target/AuthMe-*.jar" + - "target/AuthMe-*.jar" test: override: - mvn clean install -B From 678891d0b82541da8f49e34d1e50271f4e454f65 Mon Sep 17 00:00:00 2001 From: games647 Date: Tue, 26 Jan 2016 21:30:11 +0100 Subject: [PATCH 08/12] Don't schedule more tasks if the plugin is disabled (Fixes Xephi/AuthMeReloaded#433) --- .../authme/process/quit/AsynchronousQuit.java | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java index 80dd49b99..00b477440 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java @@ -75,18 +75,21 @@ public class AsynchronousQuit { } if (Settings.isSessionsEnabled && !isKick) { if (Settings.getSessionTimeout != 0) { - BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + if (plugin.isEnabled()) { + 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); - } + @Override + public void run() { + postLogout(); + } - }, Settings.getSessionTimeout * 20 * 60); - plugin.sessions.put(name, task); + }, Settings.getSessionTimeout * 20 * 60); + + plugin.sessions.put(name, task); + } else { + //plugin is disable we canno schedule more tasks so run it directly here + postLogout(); + } } } else { PlayerCache.getInstance().removePlayer(name); @@ -94,6 +97,15 @@ public class AsynchronousQuit { } plugin.realIp.remove(name); - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, player, isOp, needToChange)); + if (plugin.isEnabled()) { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, player, isOp, needToChange)); + } + } + + private void postLogout() { + PlayerCache.getInstance().removePlayer(name); + if (database.isLogged(name)) + database.setUnlogged(name); + plugin.sessions.remove(name); } } From 0b4ddce3c405e4e1db28ea8565f6621f81cedd93 Mon Sep 17 00:00:00 2001 From: games647 Date: Thu, 28 Jan 2016 11:43:08 +0100 Subject: [PATCH 09/12] Fixes NPE on forceRegister (Fixes #473) --- .../java/fr/xephi/authme/process/register/AsyncRegister.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 38c001856..d1b1f900d 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -75,7 +75,7 @@ public class AsyncRegister { if (!preRegisterCheck()) { return; } - if (!email.isEmpty() && !email.equals("")) { + if (email != null && !email.isEmpty()) { emailRegister(); } else { passwordRegister(); From a101ce915bb98be6ce7d3b54135d40610e15441e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 29 Jan 2016 20:22:15 +0100 Subject: [PATCH 10/12] Don't print warning messages if backup on start/stop is disabled. --- src/main/java/fr/xephi/authme/PerformBackup.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 6dbb7e4f9..01f246a84 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -38,9 +38,16 @@ public class PerformBackup { * @param cause BackupCause The cause of the backup. */ public void doBackup(BackupCause cause) { + + // Do nothing if backup is disabled if (!Settings.isBackupActivated) { - ConsoleLogger.showError("Can't perform a Backup: disabled in configuration. Cause of the Backup: " + cause.name()); + // Print a warning if the backup was requested via command or by another plugin + if (cause == BackupCause.COMMAND || cause == BackupCause.OTHER) { + ConsoleLogger.showError("Can't perform a Backup: disabled in configuration. Cause of the Backup: " + cause.name()); + } + return; } + // Check whether a backup should be made at the specified point in time switch (cause) { case START: From a40b06344a4413003c1ba334515e5f13dd2f3f72 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sat, 30 Jan 2016 15:32:34 +0100 Subject: [PATCH 11/12] Minor - remove override of equals() in PropertyMapComparator - The Comparator map defines equals(Object) but this is obviously already implemented by the Object superclass --- .../authme/settings/propertymap/PropertyMapComparator.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java b/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java index e646fb61d..77f5f60ee 100644 --- a/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java +++ b/src/main/java/fr/xephi/authme/settings/propertymap/PropertyMapComparator.java @@ -31,9 +31,4 @@ final class PropertyMapComparator implements Comparator { return Node.compare(parent, p1.getPath(), p2.getPath()); } - @Override - public boolean equals(Object obj) { - return this == obj; - } - } From b299e4be9194ee8a3b012e1d8b43220951dfd13c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 31 Jan 2016 19:08:28 +0100 Subject: [PATCH 12/12] Fix missing setting --- src/main/java/fr/xephi/authme/settings/Settings.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 9f4285b64..005a922b9 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -547,6 +547,11 @@ public final class Settings { set("settings.forceCommands", new ArrayList()); changes = true; } + if (contains("settings.delayJoinMessage")) { + set("settings.delayJoinLeaveMessages", false); + set("settings.delayJoinMessage", null); + changes = true; + } if (!contains("settings.forceCommandsAsConsole")) { set("settings.forceCommandsAsConsole", new ArrayList()); changes = true;