Skip to content

Commit

Permalink
Fix respawn-at-anchor setting (#5824)
Browse files Browse the repository at this point in the history
  • Loading branch information
gibsonpil committed Jul 23, 2024
1 parent 8b08a8f commit 225bf2d
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,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());
}
Expand Down

0 comments on commit 225bf2d

Please sign in to comment.