[SPIGOT-4585] Addition to the Entity.damage() Created: 17/Jan/19  Updated: 11/Feb/24  Resolved: 11/Feb/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Math0424 Assignee: Doc
Resolution: Fixed Votes: 2
Labels: 1.13, damage

Version: This server is running CraftBukkit version git-Spigot-518206a-a5b9c7b (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Currently spigot can do 2 damage events

damage(Double) 
and
damage(Double, Entity)

what I'm proposing is to add a feature were you can add a DamageCause to it

damage(Damage, DamageCause)

This way if said entity were to die from the damage the DamageCause of that death would be whatever you set the DamageCause to.

ex.
Player.damage(20.0, DamageCause)
and the death message would be
'%Player% has been squashed by a falling block'
instead of 
'%Player% has died.'



 Comments   
Comment by Doc [ 11/Feb/24 ]

now you can pass a DamageSource with info about the damage.

https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Damageable.html#damage(double,org.bukkit.damage.DamageSource)

 

Comment by Michael Ziluck [ 01/Feb/19 ]

>> Problem is that there isn't a comprehensive DamageCause API, so that would need to be written too.

What exactly do you mean by this? What else would need to be added/implemented beyond what already exists in EntityDamageEvent.DamageCause?

Comment by md_5 [ 17/Jan/19 ]

Problem is that there isn't a comprehensive DamageCause API, so that would need to be written too.

 

You're welcome to give it a shot.

Generated at Fri Apr 11 15:29:59 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.