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.bungeecord.MessageType;
import fr.xephi.authme.service.velocity.VMessageType; import fr.xephi.authme.service.velocity.VMessageType;
import fr.xephi.authme.service.velocity.VelocitySender; import fr.xephi.authme.service.velocity.VelocitySender;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import javax.inject.Inject; import javax.inject.Inject;
@ -65,11 +64,11 @@ public class AsynchronousLogout implements AsynchronousProcess {
PlayerAuth auth = playerCache.getAuth(name); PlayerAuth auth = playerCache.getAuth(name);
database.updateSession(auth); database.updateSession(auth);
// TODO: send an update when a messaging service will be implemented (SESSION) // TODO: send an update when a messaging service will be implemented (SESSION)
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) { //if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
auth.setQuitLocation(player.getLocation()); auth.setQuitLocation(player.getLocation());
database.updateQuitLoc(auth); database.updateQuitLoc(auth);
// TODO: send an update when a messaging service will be implemented (QUITLOC) // TODO: send an update when a messaging service will be implemented (QUITLOC)
} //} AuthMeReReloaded - Always save quit location
playerCache.removePlayer(name); playerCache.removePlayer(name);
codeManager.unverify(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.service.ValidationService;
import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.SpawnLoader;
import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.util.PlayerUtils; import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -68,13 +67,16 @@ public class AsynchronousQuit implements AsynchronousProcess {
boolean wasLoggedIn = playerCache.isAuthenticated(name); boolean wasLoggedIn = playerCache.isAuthenticated(name);
if (wasLoggedIn) { if (wasLoggedIn) {
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) { //if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
Location loc = spawnLoader.getPlayerLocationOrSpawn(player); // AuthMeReReloaded - Always save quit location on quit
PlayerAuth auth = PlayerAuth.builder() Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
.name(name).location(loc) PlayerAuth authLoc = PlayerAuth.builder()
.realName(player.getName()).build(); .name(name).location(loc)
database.updateQuitLoc(auth); .realName(player.getName()).build();
} database.updateQuitLoc(authLoc);
// AuthMeReReloaded - Fix AuthMe#2769 -1
//}
String ip = PlayerUtils.getPlayerIp(player); String ip = PlayerUtils.getPlayerIp(player);
PlayerAuth auth = PlayerAuth.builder() PlayerAuth auth = PlayerAuth.builder()