Skip to content

Commit c7cc1b4

Browse files
gibsonpilJRoy
andauthored
Fix respawn-at-anchor setting. (#5825)
Co-authored-by: Josh Roy <[email protected]>
1 parent 57c9edc commit c7cc1b4

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

EssentialsSpawn/src/main/java/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,23 @@ void onPlayerRespawn(final PlayerRespawnEvent event) {
4141
return;
4242
}
4343

44-
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) && event.isAnchorSpawn() && ess.getSettings().isRespawnAtAnchor()) {
45-
return;
46-
}
47-
4844
if (ess.getSettings().getRespawnAtHome()) {
4945
final Location home;
5046

51-
Location bed = null;
52-
if (ess.getSettings().isRespawnAtBed()) {
47+
Location respawnLocation = null;
48+
if (ess.getSettings().isRespawnAtBed() &&
49+
(!VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) ||
50+
(!event.isAnchorSpawn() || ess.getSettings().isRespawnAtAnchor()))) {
5351
// cannot nuke this sync load due to the event being sync so it would hand either way
54-
bed = user.getBase().getBedSpawnLocation();
52+
if(VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01)) {
53+
respawnLocation = user.getBase().getRespawnLocation();
54+
} else { // For versions prior to 1.16.
55+
respawnLocation = user.getBase().getBedSpawnLocation();
56+
}
5557
}
5658

57-
if (bed != null) {
58-
home = bed;
59+
if (respawnLocation != null) {
60+
home = respawnLocation;
5961
} else {
6062
home = user.getHome(user.getLocation());
6163
}

0 commit comments

Comments
 (0)