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 isRespawnAtBed();
enum KeepInvPolicy {
KEEP,
DELETE,

View file

@ -1722,4 +1722,9 @@ public class Settings implements net.ess3.api.ISettings {
public boolean infoAfterDeath() {
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()) {
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) {
home = bed;
} else {
home = user.getHome(user.getLocation());
}
if (home != null) {
event.setRespawnLocation(home);
return;