#830 Refactor registration process

- Introduce registration executors: one for each registration variant; each extending class implements one registration variant and worries about that method's details only
- AsyncRegister receives the player and a registration executor
This commit is contained in:
ljacqu
2016-12-17 21:59:34 +01:00
parent a52fb95656
commit 398fa4d38d
10 changed files with 431 additions and 162 deletions
@@ -8,6 +8,7 @@ import fr.xephi.authme.process.login.AsynchronousLogin;
import fr.xephi.authme.process.logout.AsynchronousLogout;
import fr.xephi.authme.process.quit.AsynchronousQuit;
import fr.xephi.authme.process.register.AsyncRegister;
import fr.xephi.authme.process.register.executors.RegistrationExecutor;
import fr.xephi.authme.process.unregister.AsynchronousUnregister;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.command.CommandSender;
@@ -59,8 +60,8 @@ public class Management {
runTask(() -> asynchronousLogout.logout(player));
}
public void performRegister(Player player, String password, String email, boolean autoLogin) {
runTask(() -> asyncRegister.register(player, password, email, autoLogin));
public void performRegister(Player player, RegistrationExecutor registrationExecutor) {
runTask(() -> asyncRegister.register(player, registrationExecutor));
}
public void performUnregister(Player player, String password) {