#736 Remove getter for Management instance on main class

This commit is contained in:
ljacqu
2016-08-20 22:03:11 +02:00
parent 289ce7740f
commit 2f1613840e
3 changed files with 40 additions and 27 deletions
@@ -1,6 +1,5 @@
package fr.xephi.authme.process.register;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
@@ -10,6 +9,7 @@ import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.process.login.AsynchronousLogin;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.crypts.HashedPassword;
@@ -18,6 +18,7 @@ import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.BukkitService;
import fr.xephi.authme.util.StringUtils;
import fr.xephi.authme.util.Utils;
import fr.xephi.authme.util.ValidationService;
@@ -30,11 +31,11 @@ import java.util.List;
import static fr.xephi.authme.permission.PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS;
/**
* Asynchronous processing of a request for registration.
*/
public class AsyncRegister implements AsynchronousProcess {
@Inject
private AuthMe plugin;
@Inject
private DataSource database;
@@ -59,6 +60,13 @@ public class AsyncRegister implements AsynchronousProcess {
@Inject
private SendMailSSL sendMailSsl;
@Inject
private AsynchronousLogin asynchronousLogin;
@Inject
private BukkitService bukkitService;
AsyncRegister() { }
private boolean preRegisterCheck(Player player, String password) {
@@ -145,7 +153,7 @@ public class AsyncRegister implements AsynchronousProcess {
syncProcessManager.processSyncEmailRegister(player);
}
private void passwordRegister(Player player, String password, boolean autoLogin) {
private void passwordRegister(final Player player, String password, boolean autoLogin) {
final String name = player.getName().toLowerCase();
final String ip = Utils.getPlayerIp(player);
final HashedPassword hashedPassword = passwordSecurity.computeHash(password, name);
@@ -163,7 +171,12 @@ public class AsyncRegister implements AsynchronousProcess {
}
if (!service.getProperty(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER) && autoLogin) {
plugin.getManagement().performLogin(player, "dontneed", true);
bukkitService.runTaskAsynchronously(new Runnable(){
@Override
public void run() {
asynchronousLogin.login(player, "dontneed", true);
}
});
}
syncProcessManager.processSyncPasswordRegister(player);