Skip to main content

yog_event/player/
life.rs

1//! Players dying and coming back.
2
3use yog_data::Schema;
4
5/// Fired when a player dies.
6///
7/// - `Pre`  — fires before death is processed; return `false` to prevent death
8///   (entity survives at 0.5 HP).
9/// - `Post` — fires after the player has died.
10#[derive(Debug, Clone, Schema)]
11pub struct Death {
12    pub player_name: String,
13    pub uuid: String,
14    /// Damage source identifier, e.g. `"player"`, `"fall"`.
15    pub source: String,
16    pub dimension: String,
17}
18
19/// Fired when a player respawns after death (Post only).
20#[derive(Debug, Clone, Schema)]
21pub struct Respawn {
22    pub player_name: String,
23    pub uuid: String,
24    /// True if respawning at a bed or respawn anchor; false for world spawn.
25    pub at_anchor: bool,
26    /// Dimension respawned into (may differ from where the player died).
27    pub dimension: String,
28}