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,13 +1,10 @@
package fr.xephi.authme.command.executable.changepassword;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.task.ChangePasswordTask;
import fr.xephi.authme.util.BukkitService;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.util.ValidationService;
import fr.xephi.authme.util.ValidationService.ValidationResult;
import org.bukkit.entity.Player;
@@ -26,15 +23,11 @@ public class ChangePasswordCommand extends PlayerCommand {
@Inject
private PlayerCache playerCache;
@Inject
private BukkitService bukkitService;
@Inject
private ValidationService validationService;
@Inject
// TODO ljacqu 20160531: Remove this once change password task runs as a process (via Management)
private PasswordSecurity passwordSecurity;
private Management management;
@Override
public void runCommand(Player player, List<String> arguments) {
@@ -54,9 +47,7 @@ public class ChangePasswordCommand extends PlayerCommand {
return;
}
AuthMe plugin = AuthMe.getInstance();
// TODO ljacqu 20160117: Call async task via Management
bukkitService.runTaskAsynchronously(
new ChangePasswordTask(plugin, player, oldPassword, newPassword, passwordSecurity));
management.performPasswordChange(player, oldPassword, newPassword);
}
}