mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-12-28 11:04:21 +00: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
3 changed files with 15 additions and 1 deletions
|
@ -379,6 +379,8 @@ public interface ISettings extends IConf {
|
|||
|
||||
boolean infoAfterDeath();
|
||||
|
||||
boolean isRespawnAtBed();
|
||||
|
||||
enum KeepInvPolicy {
|
||||
KEEP,
|
||||
DELETE,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue