diff --git a/common/src/main/java/net/william278/huskhomes/config/Settings.java b/common/src/main/java/net/william278/huskhomes/config/Settings.java index 6ca0e9ee..712dd23a 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Settings.java +++ b/common/src/main/java/net/william278/huskhomes/config/Settings.java @@ -165,6 +165,9 @@ public class Settings { @YamlKey("general.description_regex") private String descriptionRegex = "\\A\\p{ASCII}*\\z"; + @YamlComment("Whether the user should back to spawn when they die") + @YamlKey("general.always_respawn_at_spawn") + private boolean alwaysRespawnAtSpawn = false; // Back command settings @YamlComment("Whether /back should work to teleport the user to where they died") @@ -439,6 +442,10 @@ public String getDescriptionRegex() { return descriptionRegex; } + public boolean doAlwaysRespawnAtSpawn() { + return alwaysRespawnAtSpawn; + } + public boolean doBackCommandReturnByDeath() { return backCommandReturnByDeath; } diff --git a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java index e7ee5aca..e617f394 100644 --- a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java +++ b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java @@ -298,7 +298,9 @@ protected final void handlePlayerTeleport(@NotNull OnlineUser onlineUser, @NotNu * @param position the new spawn point */ protected final void handlePlayerUpdateSpawnPoint(@NotNull OnlineUser onlineUser, @NotNull Position position) { - if (plugin.getSettings().doCrossServer() && plugin.getSettings().isGlobalRespawning()) { + if (!plugin.getSettings().doAlwaysRespawnAtSpawn() + && plugin.getSettings().doCrossServer() + && plugin.getSettings().isGlobalRespawning()) { plugin.getDatabase().setRespawnPosition(onlineUser, position); } } diff --git a/docs/Config-Files.md b/docs/Config-Files.md index 8aae1e20..c9aa9bbd 100644 --- a/docs/Config-Files.md +++ b/docs/Config-Files.md @@ -84,6 +84,8 @@ general: back_command_return_by_death: true # Whether /back should work with other plugins that use the PlayerTeleportEvent (can cause conflicts) back_command_save_teleport_event: false + # Whether the user should back to spawn when they die (ensure that cross_server.enabled and cross_server.global_respawning are enabled) + always_respawn_at_spawn: true # How many items should be displayed per-page in chat menu lists list_items_per_page: 12 # Whether teleportation should be carried out asynchronously (ensuring chunks load before teleporting) @@ -193,4 +195,4 @@ This file is only present if your server uses cross-server mode to run HuskHomes name: beta ``` - \ No newline at end of file +