Fix respawn-at-anchor setting. (#5825)

Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
Gibson Pilconis 2024-11-24 22:15:25 -05:00 committed by GitHub
parent 57c9edcc0c
commit c7cc1b4f93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,21 +41,23 @@ class EssentialsSpawnPlayerListener implements Listener {
return; return;
} }
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) && event.isAnchorSpawn() && ess.getSettings().isRespawnAtAnchor()) {
return;
}
if (ess.getSettings().getRespawnAtHome()) { if (ess.getSettings().getRespawnAtHome()) {
final Location home; final Location home;
Location bed = null; Location respawnLocation = null;
if (ess.getSettings().isRespawnAtBed()) { 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 // 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) { if (respawnLocation != null) {
home = bed; home = respawnLocation;
} else { } else {
home = user.getHome(user.getLocation()); home = user.getHome(user.getLocation());
} }