Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to make user return to spawn when dies #540

Merged
merged 4 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.spawn_command_return_by_death")
Yuhtin marked this conversation as resolved.
Show resolved Hide resolved
private boolean spawnReturnByDeath = false;

// Back command settings
@YamlComment("Whether /back should work to teleport the user to where they died")
Expand Down Expand Up @@ -439,6 +442,10 @@ public String getDescriptionRegex() {
return descriptionRegex;
}

public boolean doSpawnReturnByDeath() {
return spawnReturnByDeath;
}

public boolean doBackCommandReturnByDeath() {
return backCommandReturnByDeath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,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().doSpawnReturnByDeath()
&& plugin.getSettings().doCrossServer()
&& plugin.getSettings().isGlobalRespawning()) {
plugin.getDatabase().setRespawnPosition(onlineUser, position);
}
}
Expand Down
Loading