From c7cc1b4f935260d8f97d42c253b2424604b3db0b Mon Sep 17 00:00:00 2001 From: Gibson Pilconis <157770431+gibsonpil@users.noreply.github.com> Date: Sun, 24 Nov 2024 22:15:25 -0500 Subject: [PATCH] Fix respawn-at-anchor setting. (#5825) Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com> --- .../spawn/EssentialsSpawnPlayerListener.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 3e1078f54a1..6f2b8902af7 100644 --- a/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -41,21 +41,23 @@ void onPlayerRespawn(final PlayerRespawnEvent event) { return; } - if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) && event.isAnchorSpawn() && ess.getSettings().isRespawnAtAnchor()) { - return; - } - if (ess.getSettings().getRespawnAtHome()) { final Location home; - Location bed = null; - if (ess.getSettings().isRespawnAtBed()) { + Location respawnLocation = null; + if (ess.getSettings().isRespawnAtBed() && + (!VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) || + (!event.isAnchorSpawn() || ess.getSettings().isRespawnAtAnchor()))) { // cannot nuke this sync load due to the event being sync so it would hand either way - bed = user.getBase().getBedSpawnLocation(); + if(VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01)) { + respawnLocation = user.getBase().getRespawnLocation(); + } else { // For versions prior to 1.16. + respawnLocation = user.getBase().getBedSpawnLocation(); + } } - if (bed != null) { - home = bed; + if (respawnLocation != null) { + home = respawnLocation; } else { home = user.getHome(user.getLocation()); }