scoreboard players reset @s death_count

execute unless entity @s[tag=hide_default_death_message] run function pctf:logic/player/death_messages/check
tag @s remove hide_default_death_message

execute if entity @s[tag=has_flag] run function pctf:logic/player/check_flag
function pctf:logic/player/start_spectating
tag @s remove no_drop
effect clear @s
effect give @s minecraft:saturation 5 0 true

execute if score @s invis_timer matches 1.. run scoreboard players set @s invis_timer 2

execute if score @s gravity_timer matches 1.. run scoreboard players set @s gravity_timer 2
execute if score @s invulnerable_timer matches 1.. run scoreboard players set @s invulnerable_timer 2
execute if score @s trapped_timer matches 1.. run scoreboard players set @s trapped_timer 2
execute if score @s giant_timer matches 1.. run scoreboard players set @s giant_timer 2
execute if score @s weak_knees_timer matches 1.. run scoreboard players set @s weak_knees_timer 2
execute if score @s no_blocks_timer matches 1.. run scoreboard players set @s no_blocks_timer 2

scoreboard players set @s infected_timer 0
scoreboard players set @s liftoff_timer 0

scoreboard players add @s deaths_this_game 1
scoreboard players add @s total_deaths 1

scoreboard players set @s kill_streak_timer 2

clear @s

tag @s add death_temp
execute as @e[type=rabbit,tag=jump_rabbit] if score @s real_ID = @n[tag=death_temp] real_ID run kill @s
execute as @e[type=item_display,tag=lucky_block] if score @s real_ID = @n[tag=death_temp] real_ID run kill @s
execute as @e[type=marker,tag=time_warp_scroll] if score @s real_ID = @n[tag=death_temp] real_ID run kill @s
tag @s remove death_temp

execute if score .elimination settings matches 1 if entity @s[team=blue] if entity @n[tag=red_flag_dropoff,tag=captured_aqua,tag=captured_green] run function pctf:logic/game/elimination/eliminated
execute if score .elimination settings matches 1 if entity @s[team=red] if entity @n[tag=blue_flag_dropoff,tag=captured_light_purple,tag=captured_yellow] run function pctf:logic/game/elimination/eliminated

function pctf:logic/player/gems/death_remove