Fix messaging [WIP] (#1614)

* Fix messaging [WIP]

* Make codeclimate happy

* Codeclimate, pls

* got it, i hope

* Improvements

* Remove duplicated checks, other improvements, make login/logout broadcasts

* Optimize project imports

* Make codeclimate happy again
This commit is contained in:
Gabriele C
2018-08-26 15:29:47 +02:00
committed by GitHub
parent adb3c06f51
commit da7e7edc37
25 changed files with 130 additions and 59 deletions
@@ -35,16 +35,17 @@ public class AsyncChangeEmail implements AsynchronousProcess {
@Inject
private BungeeSender bungeeSender;
@Inject
private BukkitService bukkitService;
AsyncChangeEmail() { }
AsyncChangeEmail() {
}
/**
* Handles the request to change the player's email address.
*
* @param player the player to change the email for
* @param player the player to change the email for
* @param oldEmail provided old email
* @param newEmail provided new email
*/
@@ -70,6 +71,14 @@ public class AsyncChangeEmail implements AsynchronousProcess {
}
}
/**
* Saves the new email value into the database and informs services.
*
* @param auth the player auth object
* @param player the player object
* @param oldEmail the old email value
* @param newEmail the new email value
*/
private void saveNewEmail(PlayerAuth auth, Player player, String oldEmail, String newEmail) {
EmailChangedEvent event = bukkitService.createAndCallEvent(isAsync
-> new EmailChangedEvent(player, oldEmail, newEmail, isAsync));