PaperMC / PaperMC/Paper

Cancelling the EntityDamageEvent and using setHealth(0) will call PlayerDeathEvent twice

Open
#12,148 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted version: 1.21.4
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

PlayerDeathEvent should only be called once

Observed/Actual behavior

PlayerDeathEvent is called twice

Steps/models to reproduce

Listen to an EntityDamageEvent and PlayerDeathEvent.

if the entity in the damage event is a player, cancel the event and call entity.setHealth(0);

Take fall damage or something so that you die, and the player death event will be called twice

Plugin and Datapack List

Irrelevant, confirmed by @lynxplay

Paper version

This server is running Paper version 1.21.4-164-main@8eb8e44 (2025-02-16T22:13:26Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are 8 version(s) behind
Download the new version at: https://papermc.io/downloads/paper
Previous version: 1.21.1-119-7cd4f2c (MC: 1.21.1)

Other

Did not used to happen on 1.21.1 or earlier

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with EntityDamageEvent and PlayerDeathEvent on Paper 1.21.4-164, cancelling the damage and calling setHealth(0) as described. Trace the death-event flow and verify that the same scenario fires PlayerDeathEvent only once, while preserving normal death behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.