Add config option to respawn at respawn anchors (#3498)

This commit is contained in:
Josh Roy 2020-07-17 17:13:30 -04:00 committed by GitHub
parent cedd42f411
commit e34984513d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 0 deletions

View File

@ -107,6 +107,8 @@ public interface ISettings extends IConf {
boolean getRespawnAtHome();
boolean isRespawnAtAnchor();
Set getMultipleHomes();
int getHomeLimit(String set);

View File

@ -61,6 +61,11 @@ public class Settings implements net.ess3.api.ISettings {
return config.getBoolean("respawn-at-home", false);
}
@Override
public boolean isRespawnAtAnchor() {
return config.getBoolean("respawn-at-anchor", false);
}
@Override
public boolean getUpdateBedAtDaytime() {
return config.getBoolean("update-bed-at-daytime", true);

View File

@ -1034,6 +1034,9 @@ spawn-join-listener-priority: high
# When users die, should they respawn at their first home or bed, instead of the spawnpoint?
respawn-at-home: false
# When users die, should EssentialsSpawn respect users' respawn anchors?
respawn-at-anchor: false
# Teleport all joining players to the spawnpoint
spawn-on-join: false
# The following value of `guests` states that all players in group `guests` will be teleported to spawn when joining.

View File

@ -6,6 +6,7 @@ import com.earth2me.essentials.User;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.SimpleTextPager;
import com.earth2me.essentials.utils.VersionUtil;
import io.papermc.lib.PaperLib;
import net.ess3.api.IEssentials;
import org.bukkit.Location;
@ -42,6 +43,10 @@ class EssentialsSpawnPlayerListener implements Listener {
return;
}
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_16_1_R01) && event.isAnchorSpawn() && ess.getSettings().isRespawnAtAnchor()) {
return;
}
if (ess.getSettings().getRespawnAtHome()) {
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.