Forgot about this... #570

This commit is contained in:
Gabriele C 2016-03-03 21:17:38 +01:00
parent e4d2747fae
commit b0d230be60

View File

@ -74,19 +74,20 @@ public class AsyncRegister {
} }
//check this in both possiblities so don't use 'else if' //check this in both possiblities so don't use 'else if'
Integer size = 0;
Integer maxReg = Settings.getmaxRegPerIp;
if (database.isAuthAvailable(name)) { if (database.isAuthAvailable(name)) {
m.send(player, MessageKey.NAME_ALREADY_REGISTERED); m.send(player, MessageKey.NAME_ALREADY_REGISTERED);
return false; return false;
} else if(Settings.getmaxRegPerIp > 0 } else if(Settings.getmaxRegPerIp > 0
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
&& !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("127.0.0.1")
&& !ip.equalsIgnoreCase("localhost") && !ip.equalsIgnoreCase("localhost")
&& (size = database.getAllAuthsByIp(ip).size()) >= maxReg) { && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)) {
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, maxReg.toString(), size.toString()); Integer maxReg = Settings.getmaxRegPerIp;
List<String> otherAccounts = database.getAllAuthsByIp(ip);
if (otherAccounts.size() >= maxReg) {
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, maxReg.toString(), Integer.toString(otherAccounts.size()), otherAccounts.toString());
return false; return false;
} }
}
return true; return true;
} }
@ -101,7 +102,10 @@ public class AsyncRegister {
} }
private void emailRegister() { private void emailRegister() {
if(Settings.getmaxRegPerEmail > 0 && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)) { if(Settings.getmaxRegPerEmail > 0
&& !ip.equalsIgnoreCase("127.0.0.1")
&& !ip.equalsIgnoreCase("localhost")
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)) {
Integer maxReg = Settings.getmaxRegPerIp; Integer maxReg = Settings.getmaxRegPerIp;
List<String> otherAccounts = database.getAllAuthsByIp(ip); List<String> otherAccounts = database.getAllAuthsByIp(ip);
if (otherAccounts.size() >= maxReg) { if (otherAccounts.size() >= maxReg) {