Implements onRespawnCommands BentoBox#1719 (#406)

This commit is contained in:
BONNe 2021-03-16 21:33:27 +02:00 committed by GitHub
parent 440f4694de
commit 58ecd1ce1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.block.Biome;
import org.bukkit.entity.EntityType;
import org.eclipse.jdt.annotation.NonNull;
import com.google.common.base.Enums;
@ -422,6 +423,21 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "island.commands.on-leave", since = "1.8.0")
private List<String> onLeaveCommands = new ArrayList<>();
@ConfigComment("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 = "island.commands.on-respawn", since = "1.14.0")
private List<String> onRespawnCommands = new ArrayList<>();
// Sethome
@ConfigComment("Allow setting home in the nether. Only available on nether islands, not vanilla nether.")
@ConfigEntry(path = "island.sethome.nether.allow")
@ -1389,6 +1405,25 @@ public class Settings implements WorldSettings {
this.onLeaveCommands = onLeaveCommands;
}
/**
* @return the onRespawnCommands
*/
@NonNull
@Override
public List<String> getOnRespawnCommands() {
return onRespawnCommands;
}
/**
* Sets on respawn commands.
*
* @param onRespawnCommands the on respawn commands
*/
public void setOnRespawnCommands(List<String> onRespawnCommands) {
this.onRespawnCommands = onRespawnCommands;
}
/**
* @return the onJoinResetHealth
*/

View File

@ -379,6 +379,20 @@ island:
# Note that player-executed commands might not work, as these commands can be run with said player being offline.
# Added since 1.8.0.
on-leave: []
# Returns a list of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.
# These commands are run by the console, unless otherwise stated using the [SUDO] prefix,
# in which case they are executed by the player.
#
# Available placeholders for the commands are the following:
# * [name]: name of the player
#
# Here are some examples of valid commands to execute:
# * '[SUDO] bbox version'
# * 'bsbadmin deaths set [player] 0'
#
# Note that player-executed commands might not work, as these commands can be run with said player being offline.
# Added since 1.14.0.
on-respawn: []
sethome:
nether:
# Allow setting home in the nether. Only available on nether islands, not vanilla nether.