Add option to disable players respawning at beds (#3802)

Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
MD 2021-01-02 03:02:55 +00:00 committed by GitHub
parent 6864af762c
commit e2c6170eba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -379,6 +379,8 @@ public interface ISettings extends IConf {
boolean infoAfterDeath(); boolean infoAfterDeath();
boolean isRespawnAtBed();
enum KeepInvPolicy { enum KeepInvPolicy {
KEEP, KEEP,
DELETE, DELETE,

View File

@ -1722,4 +1722,9 @@ public class Settings implements net.ess3.api.ISettings {
public boolean infoAfterDeath() { public boolean infoAfterDeath() {
return config.getBoolean("send-info-after-death", false); return config.getBoolean("send-info-after-death", false);
} }
@Override
public boolean isRespawnAtBed() {
return config.getBoolean("respawn-at-home-bed", true);
}
} }

View File

@ -47,12 +47,19 @@ class EssentialsSpawnPlayerListener implements Listener {
if (ess.getSettings().getRespawnAtHome()) { if (ess.getSettings().getRespawnAtHome()) {
final Location home; final Location home;
final Location bed = user.getBase().getBedSpawnLocation(); // cannot nuke this sync load due to the event being sync so it would hand either way.
Location bed = null;
if (ess.getSettings().isRespawnAtBed()) {
// cannot nuke this sync load due to the event being sync so it would hand either way
bed = user.getBase().getBedSpawnLocation();
}
if (bed != null) { if (bed != null) {
home = bed; home = bed;
} else { } else {
home = user.getHome(user.getLocation()); home = user.getHome(user.getLocation());
} }
if (home != null) { if (home != null) {
event.setRespawnLocation(home); event.setRespawnLocation(home);
return; return;