From b40df54c9aa7c21ee9397a094a9bf90249ec757c Mon Sep 17 00:00:00 2001 From: HaHaWTH Date: Mon, 25 Mar 2024 02:33:05 +0800 Subject: [PATCH] Fix #57 --- .../java/fr/xephi/authme/process/login/AsynchronousLogin.java | 1 + .../java/fr/xephi/authme/service/TeleportationService.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java index 9a32a92f..4ef46fc8 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java @@ -274,6 +274,7 @@ public class AsynchronousLogin implements AsynchronousProcess { auth.setRealName(player.getName()); auth.setLastLogin(System.currentTimeMillis()); auth.setLastIp(ip); + auth.setQuitLocation(player.getLocation()); dataSource.updateSession(auth); // TODO: send an update when a messaging service will be implemented (SESSION) diff --git a/src/main/java/fr/xephi/authme/service/TeleportationService.java b/src/main/java/fr/xephi/authme/service/TeleportationService.java index c5f27052..c23cae4a 100644 --- a/src/main/java/fr/xephi/authme/service/TeleportationService.java +++ b/src/main/java/fr/xephi/authme/service/TeleportationService.java @@ -142,8 +142,9 @@ public class TeleportationService implements Reloadable { logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName()); teleportToSpawn(player, true); } else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) { - if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) { + if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) { Location location = buildLocationFromAuth(player, auth); + if (location.equals(player.getLocation())) return; logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName()); teleportBackFromSpawn(player, location); } else if (limbo != null && limbo.getLocation() != null) {