Merge master into '450-new-settings-rewrite'

Conflicts:
  - PerformBackup.java
  - Settings.java
This commit is contained in:
ljacqu
2016-01-31 21:31:42 +01:00
14 changed files with 48 additions and 209 deletions
@@ -57,9 +57,14 @@ public class PerformBackup {
*/
public void doBackup(BackupCause cause) {
if (!settings.getProperty(BackupSettings.ENABLED)) {
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
if (BackupCause.START.equals(cause) && !settings.getProperty(BackupSettings.ON_SERVER_START)
|| BackupCause.STOP.equals(cause) && !settings.getProperty(BackupSettings.ON_SERVER_STOP)) {
@@ -196,7 +201,8 @@ public class PerformBackup {
public enum BackupCause {
START,
STOP,
COMMAND
COMMAND,
OTHER
}
}
@@ -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;
@@ -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
@@ -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) {
@@ -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);
}
}
@@ -75,7 +75,7 @@ public class AsyncRegister {
if (!preRegisterCheck()) {
return;
}
if (!email.isEmpty() && !email.equals("")) {
if (email != null && !email.isEmpty()) {
emailRegister();
} else {
passwordRegister();
@@ -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;
@@ -19,7 +19,6 @@ import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
@@ -31,9 +31,4 @@ final class PropertyMapComparator implements Comparator<Property> {
return Node.compare(parent, p1.getPath(), p2.getPath());
}
@Override
public boolean equals(Object obj) {
return this == obj;
}
}