Change password task to async process

- Perform async change password task just like other async processes: via Management
- Remove legacy setting
- Remove now unused service getter (#736)
This commit is contained in:
ljacqu
2016-06-15 20:56:34 +02:00
parent 15886fb517
commit ac484345a2
6 changed files with 65 additions and 72 deletions
@@ -1,5 +1,6 @@
package fr.xephi.authme.process;
import fr.xephi.authme.process.changepassword.AsyncChangePassword;
import fr.xephi.authme.process.email.AsyncAddEmail;
import fr.xephi.authme.process.email.AsyncChangeEmail;
import fr.xephi.authme.process.join.AsynchronousJoin;
@@ -36,9 +37,12 @@ public class Management {
private AsynchronousLogin asynchronousLogin;
@Inject
private AsynchronousUnregister asynchronousUnregister;
@Inject
private AsyncChangePassword asyncChangePassword;
Management() { }
public void performLogin(final Player player, final String password, final boolean forceLogin) {
runTask(new Runnable() {
@Override
@@ -111,6 +115,15 @@ public class Management {
});
}
public void performPasswordChange(final Player player, final String oldPassword, final String newPassword) {
runTask(new Runnable() {
@Override
public void run() {
asyncChangePassword.changePassword(player, oldPassword, newPassword);
}
});
}
private void runTask(Runnable runnable) {
bukkitService.runTaskAsynchronously(runnable);
}