Remove cache-update bungee messages, always use the player in the context to send bungee messages, minor codestyle changes

This commit is contained in:
Gabriele C
2022-08-18 01:48:34 +02:00
parent fd0a0a1155
commit 7c8bbe6294
16 changed files with 112 additions and 186 deletions
@@ -10,8 +10,6 @@ import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.service.bungeecord.BungeeSender;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.SpawnLoader;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
@@ -53,9 +51,6 @@ public class AsynchronousQuit implements AsynchronousProcess {
@Inject
private SessionService sessionService;
@Inject
private BungeeSender bungeeSender;
AsynchronousQuit() {
}
@@ -68,8 +63,8 @@ public class AsynchronousQuit implements AsynchronousProcess {
if (player == null || validationService.isUnrestricted(player.getName())) {
return;
}
final String name = player.getName().toLowerCase();
final boolean wasLoggedIn = playerCache.isAuthenticated(name);
String name = player.getName().toLowerCase();
boolean wasLoggedIn = playerCache.isAuthenticated(name);
if (wasLoggedIn) {
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
@@ -80,7 +75,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
database.updateQuitLoc(auth);
}
final String ip = PlayerUtils.getPlayerIp(player);
String ip = PlayerUtils.getPlayerIp(player);
PlayerAuth auth = PlayerAuth.builder()
.name(name)
.realName(player.getName())
@@ -88,7 +83,8 @@ public class AsynchronousQuit implements AsynchronousProcess {
.lastLogin(System.currentTimeMillis())
.build();
database.updateSession(auth);
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_QUITLOC, name);
// TODO: send an update when a messaging service will be implemented (QUITLOC)
}
//always unauthenticate the player - use session only for auto logins on the same ip