Paper
Paper copied to clipboard
playerDeathEvent.getLastDamageCause()).getCause().name() equals "CUSTOM" when the player is impaled (i.e. no programmed deathcause yet)
Expected behavior
I expected the getCause().name() function to return "IMPALED" or something like that when the player takes damage from a stalagmite (the ones on the floor)
Observed/Actual behavior
getCause().name() output "CUSTOM"
Steps/models to reproduce
- output the Objects.requireNonNull(e.getEntity().getLastDamageCause()).getCause().name() in a PlayerDeathEvent to the console
- /damage @s 20 minecraft:stalagmite
- The console outputs "CUSTOM"
Plugin and Datapack List
None that influence this behaveiour (Plugman)
Paper version
git-Paper-511 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 8d040fa)
Other
Just something that I found while implementing custom death messages
Pretty sure the issue is because that command not send a block/entity who caused the damage and CraftBukkit not expect this then when handle what is the cause use the CUSTOM for this "default" cases... if you set a damager in the command pretty sure the Cause change to ENTITY_ATTACK
now not sure about the correct fix.. mostly because DamageCause != DamageType
(where DamageType used in the command come from NMS), also DamageCause in docs "speak" about the cause and the Cause is not a Stalagmite because this Stalagmite not exists.. you try to damage with a damage of type Stalagmite what is a different thing (in docs)...
Can reproduce, falling onto a stalagmite outputs "CONTACT" (as expected) but damage via command outputs "CUSTOM"
Can reproduce, falling onto a stalagmite outputs "CONTACT" (as expected) but damage via command outputs "CUSTOM"
yeah the currently command only send the damage with not other info like the blockposition then CraftBukkit handle the damage like CUSTOM... in teory with my PR in upstream exposing the NMS DamageSource this can be more easy to handle this (even that PR https://github.com/PaperMC/Paper/pull/8058) other thing is improvement the CraftBukkit thing.. but currently is a mess then not sure if is a valid fix.