mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
fix: save_on_teleport_event not working as intended (#817)
This commit is contained in:
1 parent
c3751b5cde
commit
0a77eb0605
1 file changed
+4
-4
@@ -287,18 +287,18 @@ public abstract class EventListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle when a player teleports.
|
* 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 onlineUser the {@link OnlineUser} who teleported
|
||||||
* @param sourcePosition the source {@link Position} they came from
|
* @param sourcePosition the source {@link Position} they came from
|
||||||
*/
|
*/
|
||||||
protected final void handlePlayerTeleport(@NotNull OnlineUser onlineUser, @NotNull Position sourcePosition) {
|
protected final void handlePlayerTeleport(@NotNull OnlineUser onlineUser, @NotNull Position sourcePosition) {
|
||||||
final Settings.GeneralSettings.BackCommandSettings back = plugin.getSettings().getGeneral().getBackCommand();
|
final Settings.GeneralSettings.BackCommandSettings back = plugin.getSettings().getGeneral().getBackCommand();
|
||||||
if (!back.isSaveOnTeleportEvent() || back.canReturnToWorld(sourcePosition.getWorld())) {
|
if (back.isSaveOnTeleportEvent() && back.canReturnToWorld(sourcePosition.getWorld())) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the player's last position
|
// Set the player's last position
|
||||||
plugin.runAsync(() -> plugin.getDatabase().setLastPosition(onlineUser, sourcePosition));
|
plugin.runAsync(() -> plugin.getDatabase().setLastPosition(onlineUser, sourcePosition));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user