Note: When I mention "attack," I mean a melee attack (i.e. not with a snowball or bow).
EntityDamageByEntityEvent: When a player attacks another player, the cause is ENTITY_ATTACK
Using Entity#damage(damage, (Player)source): Haven't tested with other entities as source, but this fires a EntityDamageByEntityEvent, as if the source attacked the Entity (complete with a cause = ENTITY_ATTACK).
PlayerVelocityEvent: When a player attacks another player, a PlayerVelocityEvent is fired. This velocity event is 0 in the x and z direction (perhaps to reset the player's current movement?). However, if this velocity event is canceled, another velocity event is fired - this time with appropriate knockback values
Ideas why:
- perhaps to "add on" to whatever prior velocity the player might be experiencing (since prior was canceled)