Implement onRespawnCommands() option from BentoBox 1.14.

This commit is contained in:
BONNe 2021-03-15 14:49:16 +02:00
parent 9006a5f4d4
commit c12310a627
2 changed files with 67 additions and 6 deletions

View File

@ -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<String> 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<String> 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<String> 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<String> 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<String> 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")

View File

@ -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.