From 0a77eb0605ab53065d72c2c55c229320caf3b550 Mon Sep 17 00:00:00 2001 From: cgw2023 <136877036+cgw2023@users.noreply.github.com> Date: Wed, 30 Apr 2025 03:53:45 +0800 Subject: [PATCH] fix: save_on_teleport_event not working as intended (#817) --- .../net/william278/huskhomes/listener/EventListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java index 34939ac2..462228f0 100644 --- a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java +++ b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java @@ -287,18 +287,18 @@ public abstract class EventListener { /** * Handle when a player teleports. + * When save_on_teleport_event in config is true and the world can be return, set user's last position. * * @param onlineUser the {@link OnlineUser} who teleported * @param sourcePosition the source {@link Position} they came from */ protected final void handlePlayerTeleport(@NotNull OnlineUser onlineUser, @NotNull Position sourcePosition) { final Settings.GeneralSettings.BackCommandSettings back = plugin.getSettings().getGeneral().getBackCommand(); - if (!back.isSaveOnTeleportEvent() || back.canReturnToWorld(sourcePosition.getWorld())) { - return; - } - + if (back.isSaveOnTeleportEvent() && back.canReturnToWorld(sourcePosition.getWorld())) { // Set the player's last position plugin.runAsync(() -> plugin.getDatabase().setLastPosition(onlineUser, sourcePosition)); + } + } /**