Implement bungee messaging, CacheDataSource sync

This commit is contained in:
Gabriele C
2017-10-30 10:38:13 +01:00
parent a5542051f4
commit 2d2eb740e3
21 changed files with 233 additions and 25 deletions
@@ -5,6 +5,7 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.ValidationService;
import org.bukkit.entity.Player;
@@ -28,6 +29,9 @@ public class AsyncChangeEmail implements AsynchronousProcess {
@Inject
private ValidationService validationService;
@Inject
private BungeeService bungeeService;
AsyncChangeEmail() { }
/**
@@ -63,6 +67,7 @@ public class AsyncChangeEmail implements AsynchronousProcess {
auth.setEmail(newEmail);
if (dataSource.updateEmail(auth)) {
playerCache.updatePlayer(auth);
bungeeService.sendRefreshEmail(player.getName());
service.send(player, MessageKey.EMAIL_CHANGED_SUCCESS);
} else {
service.send(player, MessageKey.ERROR);