Add /back returning-by-death

This commit is contained in:
William committed 2022-08-22 17:37:11 +01:00
1 parent 6cd2a23770
commit 8dff4a123a
6 files changed
+24 -11

No files matched your search

@@ -89,6 +89,9 @@ public class Settings {
@KeyPath("general.permission_restrict_warps")
public boolean permissionRestrictWarps = false;
@KeyPath("general.back_command_return_by_death")
public boolean backCommandReturnByDeath = true;
@KeyPath("general.teleport_warmup_time")
public int teleportWarmupTime = 5;
@@ -97,10 +100,6 @@ public class Settings {
@KeyPath("general.teleport_request_expiry_time")
public int teleportRequestExpiryTime = 60;
@KeyPath("general.list_items_per_page")
public int listItemsPerPage = 12;
@KeyPath("general.strict_tpa_here_requests")
public boolean strictTpaHereRequests = true;
@@ -110,6 +109,9 @@ public class Settings {
@KeyPath("general.allow_unicode_descriptions")
public boolean allowUnicodeDescriptions = true;
@KeyPath("general.list_items_per_page")
public int listItemsPerPage = 12;
@KeyPath("general.use_paper_lib")
public boolean usePaperLib = true;
@@ -3,8 +3,10 @@ package net.william278.huskhomes.listener;
import de.themoep.minedown.MineDown;
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.util.Permission;
import org.jetbrains.annotations.NotNull;
import java.util.logging.Level;
import java.util.stream.Collectors;
/**
@@ -123,7 +125,11 @@ public class EventListener {
* @param onlineUser the {@link OnlineUser} who died
*/
protected final void handlePlayerDeath(@NotNull OnlineUser onlineUser) {
//todo
// Set the player's last position to where they died
if (plugin.getSettings().backCommandReturnByDeath
&& onlineUser.hasPermission(Permission.COMMAND_BACK_RETURN_BY_DEATH.node)) {
onlineUser.getPosition().thenAccept(position -> plugin.getDatabase().setLastPosition(onlineUser, position).join());
}
}
/**
@@ -139,7 +145,7 @@ public class EventListener {
* Handle when the plugin is disabling (server is shutting down)
*/
public final void handlePluginDisable() {
//todo
plugin.getLoggingAdapter().log(Level.INFO, "Successfully disabled HuskHomes v" + plugin.getPluginVersion());
}
}
@@ -140,7 +140,7 @@ public enum Permission {
/**
* Lets the user use {@code /back} to return to where they died
*/
COMMAND_BACK_ON_DEATH("huskhomes.command.back.death", DefaultAccess.EVERYONE),
COMMAND_BACK_RETURN_BY_DEATH("huskhomes.command.back.death", DefaultAccess.EVERYONE),
/**
* Lets the user view plugin information
*/