PaperMC / PaperMC/Paper

1.21.8 - Respawn Anchor is not returning the player who made explote it on PlayerDeathEvent

Open
#13,014 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected behavior

When you kill somebody with Respawn Anchor and you use PlayerDeathEvent to get the killer, it should return the Player who made it, for now im using BlockPlaceEvent to check what was here before and who place it, but as other things such as tnt, end crystal returns the player but for some reason not for respawn anchor

Observed/Actual behavior

if you kill a player with the below code, using a anchor it returns this:

[10:23:41 INFO]: [Is_System32_: Set own game mode to Survival Mode]
[10:23:43 INFO]: Is_System32_ has made the advancement [Not Quite "Nine" Lives]
[10:23:43 INFO]: CraftDamageType{holder=Reference{ResourceKey[minecraft:damage_type / minecraft:bad_respawn_point]=DamageType[msgId=badRespawnPoint, scaling=ALWAYS, exhaustion=0.1, effects=HURT, deathMessageType=INTENTIONAL_GAME_DESIGN]}}
[10:23:43 INFO]: Is_System32_ was killed by [Intentional Game Design]

Using a tnt or end crystal returns this, also you can use DamageSource.directEntity to check if it was a tnt or a end crystal

[10:24:00 INFO]: [Is_System32_: Set own game mode to Survival Mode]
[10:24:02 INFO]: CraftDamageType{holder=Reference{ResourceKey[minecraft:damage_type / minecraft:player_explosion]=DamageType[msgId=explosion.player, scaling=ALWAYS, exhaustion=0.1, effects=HURT, deathMessageType=DEFAULT]}}
[10:24:02 INFO]: Is_System32_ death by player: Is_System32_, item used: END_CRYSTAL, isExplosion: true
[10:24:02 INFO]: Is_System32_ was blown up by Is_System32_

TNT:

[10:24:19 INFO]: [Is_System32_: Set own game mode to Survival Mode]
[10:24:24 INFO]: CraftDamageType{holder=Reference{ResourceKey[minecraft:damage_type / minecraft:player_explosion]=DamageType[msgId=explosion.player, scaling=ALWAYS, exhaustion=0.1, effects=HURT, deathMessageType=DEFAULT]}}
[10:24:24 INFO]: Is_System32_ death by player: Is_System32_, item used: FLINT_AND_STEEL, isExplosion: true
[10:24:24 INFO]: Is_System32_ was blown up by Is_System32_
Steps/models to reproduce
@EventHandler(priority = EventPriority.HIGHEST)
    fun onPlayerDeathEvent(event: PlayerDeathEvent) {
        if (event.isCancelled) return
        val victim = event.entity
        val source = victim.lastDamageCause?.damageSource ?: return
        println(source.damageType)
        val killer = (source.causingEntity ?: return) as? Player ?: return
        val itemUsed = killer.inventory.itemInMainHand.type
        val isExplotion = source.damageType == DamageType.PLAYER_EXPLOSION
        println("${victim.name} death by player: ${killer.name}, item used: $itemUsed, isExplosion: $isExplotion")
    }
Plugin and Datapack List

[10:31:30 INFO]: ? Server Plugins (4):
[10:31:30 INFO]: Bukkit Plugins:
[10:31:30 INFO]: - DecentHolograms, FenixRankedSystem, PlaceholderAPI, SkinsRestorer

Paper version

[10:31:45 INFO]: This server is running Paper version 1.21.8-49-main@614e9ac (2025-08-23T21:22:35Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.8-40-f866a5f (MC: 1.21.8)

Other

No response

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 with the PlayerDeathEvent damage-source path for respawn-anchor explosions and compare how causingEntity is assigned for TNT and end crystals. Add or run a regression test covering PlayerDeathEvent and DamageSource.causingEntity, verifying that the player who triggered the anchor is returned.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.