mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-18 11:45:07 +08:00
Add config option to respawn at respawn anchors (#3498)
This commit is contained in:
parent
cedd42f411
commit
e34984513d
@ -107,6 +107,8 @@ public interface ISettings extends IConf {
|
||||
|
||||
boolean getRespawnAtHome();
|
||||
|
||||
boolean isRespawnAtAnchor();
|
||||
|
||||
Set getMultipleHomes();
|
||||
|
||||
int getHomeLimit(String set);
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user