DeathConfig
Configuration for what happens when a citizen is killed — drops, messages to the killer, and commands to execute.
package com.electro.hycitizens.models;
getDropItems / setDropItems
@Nonnull List<DeathDropItem> getDropItems()
void setDropItems(@Nonnull List<DeathDropItem> dropItems)
Items to drop at the citizen's location on death. Returns a defensive copy. See DeathDropItem.
getDeathCommands / setDeathCommands
@Nonnull List<CommandAction> getDeathCommands()
void setDeathCommands(@Nonnull List<CommandAction> commands)
Commands to execute when this citizen dies. Same structure as interaction commands. See CommandAction.
getDeathMessages / setDeathMessages
@Nonnull List<CitizenMessage> getDeathMessages()
void setDeathMessages(@Nonnull List<CitizenMessage> messages)
Messages sent to the player who killed the citizen. Supports colors and placeholders. See CitizenMessage.
getCommandSelectionMode / setCommandSelectionMode
@Nonnull String getCommandSelectionMode()
void setCommandSelectionMode(@Nonnull String mode)
Selects how death commands are run: "ALL" (default), "RANDOM", or "SEQUENTIAL".
getMessageSelectionMode / setMessageSelectionMode
@Nonnull String getMessageSelectionMode()
void setMessageSelectionMode(@Nonnull String mode)
Selects how death messages are sent: "ALL" (default), "RANDOM", or "SEQUENTIAL".
Example
DeathConfig deathConfig = new DeathConfig();
// Item drops
deathConfig.setDropItems(List.of(
new DeathDropItem("gold_coin", 10),
new DeathDropItem("rare_gem", 1)
));
// Death message
deathConfig.setDeathMessages(List.of(
new CitizenMessage("{RED}You have slain {CitizenName}!")
));
deathConfig.setMessageSelectionMode("ALL");
// Death command — give XP
deathConfig.setDeathCommands(List.of(
new CommandAction("xp add {PlayerName} 100", true)
));
citizen.setDeathConfig(deathConfig);