[SPIGOT-161] Cancelling EntityDamageEvent still deals velocity Created: 08/Dec/14  Updated: 24/Jan/15  Resolved: 24/Jan/15

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

Type: Bug Priority: Major
Reporter: Johnnywoof Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None


 Description   

When cancelling the EntityDamageEvent, the entity (a player was tested) is still knocked back (aka velocity).



 Comments   
Comment by Ryan Hamshire [ 15/Jan/15 ]

I logged this bug previously, mentioning specifically armor stands + TNT. It was resolved as won't fix.

Comment by DemonWav [ 12/Dec/14 ]

Can't replicate this myself with mobs attacking or other players.
Can you explain exactly what you did to cause this?

Comment by St3venAU [ 08/Dec/14 ]

Setting the entity's velocity to zero in the event listener does not work because the knockback is applied to the entity after the event. Scheduling zeroing the velocity for 1 tick later does work, but it's possible that the entity could move a small amount in that time and it isn't a very elegant solution.

Comment by Johnnywoof [ 08/Dec/14 ]

Well that can work, but not really what I was expecting. When I cancel the event, it means that the entity is not even touched.

Comment by Janmm14 [ 08/Dec/14 ]

Tried setting the velocity of the damaged entity to 0, 0, 0?

Comment by St3venAU [ 08/Dec/14 ]

I can confirm that I have noticed this as well with EntityDamageByEntityEvent. In my case I cancel damage to armor stands from TNTPrimed. The armor stands don't take the damage but they do take knockback.

Generated at Sat Dec 13 11:43:16 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.