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
@@ -7,7 +7,9 @@ import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.service.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.entity.Player;
@@ -33,6 +35,12 @@ public class AsynchronousLogout implements AsynchronousProcess {
@Inject
private SyncProcessManager syncProcessManager;
@Inject
private SessionService sessionService;
@Inject
private BungeeService bungeeService;
AsynchronousLogout() {
}
@@ -50,15 +58,18 @@ public class AsynchronousLogout implements AsynchronousProcess {
PlayerAuth auth = playerCache.getAuth(name);
database.updateSession(auth);
bungeeService.sendRefreshSession(name);
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
auth.setQuitLocation(player.getLocation());
database.updateQuitLoc(auth);
bungeeService.sendRefreshQuitLoc(name);
}
playerCache.removePlayer(name);
codeManager.unverify(name);
database.setUnlogged(name);
database.revokeSession(name);
sessionService.revokeSession(name);
bungeeService.sendLogout(name);
syncProcessManager.processSyncPlayerLogout(player);
}
}