diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index 00525a5..e1ce109 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -13,6 +13,7 @@ import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Biome; import org.bukkit.entity.EntityType; +import org.eclipse.jdt.annotation.NonNull; import com.google.common.base.Enums; @@ -882,6 +883,16 @@ public class Settings implements WorldSettings } + /** + * {@inheritDoc} + */ + @Override + public @NonNull List getOnRespawnCommands() + { + return this.onRespawnCommands; + } + + // --------------------------------------------------------------------- // Section: Setters // --------------------------------------------------------------------- @@ -2043,6 +2054,17 @@ public class Settings implements WorldSettings } + /** + * Sets on respawn commands. + * + * @param onRespawnCommands the on respawn commands + */ + public void setOnRespawnCommands(List onRespawnCommands) + { + this.onRespawnCommands = onRespawnCommands; + } + + // --------------------------------------------------------------------- // Section: Variables // --------------------------------------------------------------------- @@ -2493,14 +2515,51 @@ public class Settings implements WorldSettings private boolean pasteMissingIslands = false; // Commands - @ConfigComment("List of commands to run when a player joins.") - @ConfigEntry(path = "cave.commands.on-join") + @ConfigComment("List of commands to run when a player joins an cave or creates one.") + @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") + @ConfigComment("in which case they are executed by the player.") + @ConfigComment("") + @ConfigComment("Available placeholders for the commands are the following:") + @ConfigComment(" * [name]: name of the player") + @ConfigComment("") + @ConfigComment("Here are some examples of valid commands to execute:") + @ConfigComment(" * '[SUDO] bbox version'") + @ConfigComment(" * 'bsbadmin deaths set [player] 0'") + @ConfigComment("") + @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") + @ConfigEntry(path = "cave.commands.on-join", since = "1.8.0") private List onJoinCommands = new ArrayList<>(); - @ConfigComment("list of commands to run when a player leaves.") - @ConfigEntry(path = "cave.commands.on-leave") + @ConfigComment("List of commands to run when a player leaves a cave, resets his cave or gets kicked from it.") + @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") + @ConfigComment("in which case they are executed by the player.") + @ConfigComment("") + @ConfigComment("Available placeholders for the commands are the following:") + @ConfigComment(" * [name]: name of the player") + @ConfigComment("") + @ConfigComment("Here are some examples of valid commands to execute:") + @ConfigComment(" * '[SUDO] bbox version'") + @ConfigComment(" * 'bsbadmin deaths set [player] 0'") + @ConfigComment("") + @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") + @ConfigEntry(path = "cave.commands.on-leave", since = "1.8.0") private List onLeaveCommands = new ArrayList<>(); + @ConfigComment("Returns a list of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.") + @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") + @ConfigComment("in which case they are executed by the player.") + @ConfigComment("") + @ConfigComment("Available placeholders for the commands are the following:") + @ConfigComment(" * [name]: name of the player") + @ConfigComment("") + @ConfigComment("Here are some examples of valid commands to execute:") + @ConfigComment(" * '[SUDO] bbox version'") + @ConfigComment(" * 'bsbadmin deaths set [player] 0'") + @ConfigComment("") + @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") + @ConfigEntry(path = "cave.commands.on-respawn", since = "1.14.0") + private List onRespawnCommands = new ArrayList<>(); + // Sethome @ConfigComment("Allow setting home in the nether. Only available on nether islands, not vanilla nether.") @ConfigEntry(path = "cave.sethome.nether.allow") diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 4adcac0..1da2b6e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -459,10 +459,12 @@ cave: # Added since 1.10.0. create-missing-nether-end-caves: false commands: - # List of commands to run when a player joins. + # List of commands to run when a player joins an cave or creates one. on-join: [] - # list of commands to run when a player leaves. + # List of commands to run when a player leaves a cave, resets his cave or gets kicked from it. on-leave: [] + # Returns a list of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true. + on-respawn: [] sethome: nether: # Allow setting home in the nether. Only available on nether islands, not vanilla nether.