Reapply "Always save quit location and fixes #2769 issue 1"

This reverts commit 8c4da6288e0fc662df582ef6bdab5c210170e338.
This commit is contained in:
HaHaWTH 2024-05-29 14:44:28 +08:00
parent d648725b10
commit 642270e4c3
2 changed files with 14 additions and 13 deletions

View File

@ -13,7 +13,6 @@ import fr.xephi.authme.service.bungeecord.BungeeSender;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.service.velocity.VMessageType;
import fr.xephi.authme.service.velocity.VelocitySender;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.entity.Player;
import javax.inject.Inject;
@ -65,11 +64,11 @@ public class AsynchronousLogout implements AsynchronousProcess {
PlayerAuth auth = playerCache.getAuth(name);
database.updateSession(auth);
// TODO: send an update when a messaging service will be implemented (SESSION)
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
auth.setQuitLocation(player.getLocation());
database.updateQuitLoc(auth);
//if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
auth.setQuitLocation(player.getLocation());
database.updateQuitLoc(auth);
// TODO: send an update when a messaging service will be implemented (QUITLOC)
}
//} AuthMeReReloaded - Always save quit location
playerCache.removePlayer(name);
codeManager.unverify(name);

View File

@ -12,7 +12,6 @@ import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.settings.SpawnLoader;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -68,13 +67,16 @@ public class AsynchronousQuit implements AsynchronousProcess {
boolean wasLoggedIn = playerCache.isAuthenticated(name);
if (wasLoggedIn) {
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
PlayerAuth auth = PlayerAuth.builder()
.name(name).location(loc)
.realName(player.getName()).build();
database.updateQuitLoc(auth);
}
//if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
// AuthMeReReloaded - Always save quit location on quit
Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
PlayerAuth authLoc = PlayerAuth.builder()
.name(name).location(loc)
.realName(player.getName()).build();
database.updateQuitLoc(authLoc);
// AuthMeReReloaded - Fix AuthMe#2769 -1
//}
String ip = PlayerUtils.getPlayerIp(player);
PlayerAuth auth = PlayerAuth.builder()