Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into 547-process-architecture

Conflicts:
	src/main/java/fr/xephi/authme/settings/Settings.java
This commit is contained in:
ljacqu
2016-02-28 09:08:35 +01:00
9 changed files with 37 additions and 23 deletions
@@ -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();
@@ -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);