mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +01:00
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:
parent
6864af762c
commit
e2c6170eba
@ -379,6 +379,8 @@ public interface ISettings extends IConf {
|
|||||||
|
|
||||||
boolean infoAfterDeath();
|
boolean infoAfterDeath();
|
||||||
|
|
||||||
|
boolean isRespawnAtBed();
|
||||||
|
|
||||||
enum KeepInvPolicy {
|
enum KeepInvPolicy {
|
||||||
KEEP,
|
KEEP,
|
||||||
DELETE,
|
DELETE,
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user