Paper icon indicating copy to clipboard operation
Paper copied to clipboard

playerDeathEvent.getLastDamageCause()).getCause().name() equals "CUSTOM" when the player is impaled (i.e. no programmed deathcause yet)

Open Hinterhaeltiger opened this issue 1 year ago • 3 comments

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

  1. output the Objects.requireNonNull(e.getEntity().getLastDamageCause()).getCause().name() in a PlayerDeathEvent to the console
  2. /damage @s 20 minecraft:stalagmite
  3. 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

Hinterhaeltiger avatar Apr 14 '23 15:04 Hinterhaeltiger

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)...

Doc94 avatar Apr 16 '23 04:04 Doc94

Can reproduce, falling onto a stalagmite outputs "CONTACT" (as expected) but damage via command outputs "CUSTOM"

bdotsamir avatar Jun 09 '23 20:06 bdotsamir

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.

Doc94 avatar Jun 09 '23 21:06 Doc94