diff --git a/README.md b/README.md
index 5f82e524..934112c0 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ McStats: http://mcstats.org/plugin/AuthMe
#####"The best authentication plugin for the Bukkit/Spigot API!"
-
Prevent username stealing on your server! Fully compatible with UUIDs and Craftbukkit/Spigot 1.8.X!
+
Prevent username stealing on your server!
Use it to secure your Offline mode server or to increase your Online mode server's protection!
AuthMeReloaded disallows players who aren't authenticated to do actions like placing blocks, moving,
diff --git a/pom.xml b/pom.xml
index 5c83dbec..90918139 100644
--- a/pom.xml
+++ b/pom.xml
@@ -334,7 +334,7 @@
com.zaxxer
HikariCP
- 2.4.3
+ 2.4.5-SNAPSHOT
compile
diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java
index bdac0cec..e511d1d9 100644
--- a/src/main/java/fr/xephi/authme/AuthMe.java
+++ b/src/main/java/fr/xephi/authme/AuthMe.java
@@ -45,7 +45,6 @@ import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.SHA256;
import fr.xephi.authme.settings.NewSetting;
-import fr.xephi.authme.settings.OtherAccounts;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.SettingsMigrationService;
import fr.xephi.authme.settings.Spawn;
@@ -118,7 +117,6 @@ public class AuthMe extends JavaPlugin {
public NewAPI api;
public SendMailSSL mail;
public DataManager dataManager;
- public OtherAccounts otherAccounts;
public Location essentialsSpawn;
/*
* Plugin Hooks
@@ -242,6 +240,8 @@ public class AuthMe extends JavaPlugin {
try {
setupDatabase(newSettings);
} catch (Exception e) {
+ ConsoleLogger.showError("If you are using CraftBukkit/Spigot 1.9 please add the "
+ + "-Dfile.encoding=UTF-8 argument in your server startup script!");
ConsoleLogger.logException("Fatal error occurred during database connection! "
+ "Authme initialization aborted!", e);
stopOrUnload();
@@ -257,9 +257,6 @@ public class AuthMe extends JavaPlugin {
permsMan = initializePermissionsManager();
commandHandler = initializeCommandHandler(permsMan, messages, passwordSecurity, newSettings, ipAddressManager);
- // Setup otherAccounts file
- this.otherAccounts = OtherAccounts.getInstance();
-
// Set up Metrics
MetricsStarter.setupMetrics(plugin, newSettings);
diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterAdminCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterAdminCommand.java
index 7b929952..a33f3eb3 100644
--- a/src/main/java/fr/xephi/authme/command/executable/authme/RegisterAdminCommand.java
+++ b/src/main/java/fr/xephi/authme/command/executable/authme/RegisterAdminCommand.java
@@ -22,8 +22,8 @@ public class RegisterAdminCommand implements ExecutableCommand {
public void executeCommand(final CommandSender sender, List arguments,
final CommandService commandService) {
// Get the player name and password
- final String playerName = arguments.get(0).toLowerCase();
- final String playerPass = arguments.get(1).toLowerCase();
+ final String playerName = arguments.get(0);
+ final String playerPass = arguments.get(1);
final String playerNameLowerCase = playerName.toLowerCase();
final String playerPassLowerCase = playerPass.toLowerCase();
diff --git a/src/main/java/fr/xephi/authme/output/MessageKey.java b/src/main/java/fr/xephi/authme/output/MessageKey.java
index 0c96b666..3fd7c747 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", "%acc_nb"),
+ MAX_REGISTER_EXCEEDED("max_reg", "%max_acc", "%reg_count", "%reg_names"),
USAGE_REGISTER("usage_reg"),
diff --git a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java
index e9af5045..e1ef5df8 100644
--- a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java
+++ b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java
@@ -172,7 +172,6 @@ public class AsynchronousLogin implements Process {
// makes player isLoggedin via API
PlayerCache.getInstance().addPlayer(auth);
database.setLogged(name);
- plugin.otherAccounts.addPlayer(player.getUniqueId());
// As the scheduling executes the Task most likely after the current
// task, we schedule it in the end
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 fc740738..6b14bbec 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,10 @@
package fr.xephi.authme.process.register;
+import java.util.List;
+
+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;
@@ -70,17 +75,19 @@ public class AsyncRegister implements Process {
}
//check this in both possibilities so don't use 'else if'
- int size;
if (database.isAuthAvailable(name)) {
service.send(player, MessageKey.NAME_ALREADY_REGISTERED);
return false;
- } else if (Settings.getmaxRegPerIp > 0
- && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
+ } else if(Settings.getmaxRegPerIp > 0
&& !ip.equalsIgnoreCase("127.0.0.1")
&& !ip.equalsIgnoreCase("localhost")
- && (size = database.getAllAuthsByIp(ip).size()) >= Settings.getmaxRegPerIp) {
- service.send(player, MessageKey.MAX_REGISTER_EXCEEDED, Integer.toString(size));
- return false;
+ && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)) {
+ Integer maxReg = Settings.getmaxRegPerIp;
+ List 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 true;
}
@@ -97,12 +104,16 @@ public class AsyncRegister implements Process {
}
private void emailRegister() {
- int size;
- if (Settings.getmaxRegPerEmail > 0
- && !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
- && (size = database.countAuthsByEmail(email)) >= Settings.getmaxRegPerEmail) {
- service.send(player, MessageKey.MAX_REGISTER_EXCEEDED, Integer.toString(size));
- return;
+ 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;
+ List otherAccounts = database.getAllAuthsByIp(ip);
+ if (otherAccounts.size() >= maxReg) {
+ m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, maxReg.toString(), Integer.toString(otherAccounts.size()), otherAccounts.toString());
+ return;
+ }
}
final HashedPassword hashedPassword = plugin.getPasswordSecurity().computeHash(password, name);
PlayerAuth auth = PlayerAuth.builder()
@@ -148,7 +159,6 @@ public class AsyncRegister implements Process {
plugin.getManagement().performLogin(player, "dontneed", true);
}
- plugin.otherAccounts.addPlayer(player.getUniqueId());
ProcessSyncPasswordRegister sync = new ProcessSyncPasswordRegister(player, plugin, service);
service.scheduleSyncDelayedTask(sync);
diff --git a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java
deleted file mode 100644
index 6e2796a3..00000000
--- a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package fr.xephi.authme.settings;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
-/**
- * @author Xephi59
- * @version $Revision: 1.0 $
- */
-public class OtherAccounts extends CustomConfiguration {
-
- private static OtherAccounts others = null;
-
- public OtherAccounts() {
- super(new File("." + File.separator + "plugins" + File.separator + "AuthMe" + File.separator + "otheraccounts.yml"));
- others = this;
- load();
- save();
- }
-
- /**
- * Method getInstance.
- *
- * @return OtherAccounts
- */
- public static OtherAccounts getInstance() {
- if (others == null) {
- others = new OtherAccounts();
- }
- return others;
- }
-
- /**
- * Method clear.
- *
- * @param uuid UUID
- */
- public void clear(UUID uuid) {
- set(uuid.toString(), new ArrayList());
- save();
- }
-
- /**
- * Method addPlayer.
- *
- * @param uuid UUID
- */
- public void addPlayer(UUID uuid) {
- try {
- Player player = Bukkit.getPlayer(uuid);
- if (player == null)
- return;
- if (!this.getStringList(uuid.toString()).contains(player.getName())) {
- this.getStringList(uuid.toString()).add(player.getName());
- save();
- }
- } catch (NoSuchMethodError | Exception e) {
- //ignore
- }
- }
-
- /**
- * Method removePlayer.
- *
- * @param uuid UUID
- */
- public void removePlayer(UUID uuid) {
- try {
- Player player = Bukkit.getPlayer(uuid);
- if (player == null)
- return;
- if (this.getStringList(uuid.toString()).contains(player.getName())) {
- this.getStringList(uuid.toString()).remove(player.getName());
- save();
- }
- } catch (NoSuchMethodError | Exception e) {
- //ignore
- }
- }
-
- /**
- * Method getAllPlayersByUUID.
- *
- * @param uuid UUID
- *
- * @return StringList
- */
- public List getAllPlayersByUUID(UUID uuid) {
- return this.getStringList(uuid.toString());
- }
-}
diff --git a/src/main/resources/messages/messages_en.yml b/src/main/resources/messages/messages_en.yml
index 4e155bcf..5b474e2d 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 (%acc_nb) for your connection!'
+max_reg: '&cYou have exceeded the maximum number of registrations (%reg_count/%max_acc %reg_names) 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 "'