#736 Remove getter for Management instance on main class
This commit is contained in:
@@ -14,6 +14,7 @@ import fr.xephi.authme.permission.AuthGroupType;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
import fr.xephi.authme.process.AsynchronousProcess;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.process.login.AsynchronousLogin;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
@@ -33,7 +34,9 @@ import javax.inject.Inject;
|
||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
|
||||
import static fr.xephi.authme.util.BukkitService.TICKS_PER_SECOND;
|
||||
|
||||
|
||||
/**
|
||||
* Asynchronous process for when a player joins.
|
||||
*/
|
||||
public class AsynchronousJoin implements AsynchronousProcess {
|
||||
|
||||
private static final boolean DISABLE_COLLISIONS = MethodUtils
|
||||
@@ -66,6 +69,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
@Inject
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
@Inject
|
||||
private AsynchronousLogin asynchronousLogin;
|
||||
|
||||
AsynchronousJoin() {
|
||||
}
|
||||
|
||||
@@ -138,7 +144,12 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
playerCache.removePlayer(name);
|
||||
if (auth != null && auth.getIp().equals(ip)) {
|
||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
||||
plugin.getManagement().performLogin(player, "dontneed", true);
|
||||
bukkitService.runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
asynchronousLogin.login(player, "dontneed", true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else if (service.getProperty(PluginSettings.SESSIONS_EXPIRE_ON_IP_CHANGE)) {
|
||||
service.send(player, MessageKey.SESSION_EXPIRED);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user