Solved ProjectileHitEvent and EntityDamageByEntityEvent

Discussion in 'Plugin Development' started by Chr0mosom3, Apr 4, 2021.

  1. Offline

    Chr0mosom3

    Hello,

    Simple question, how would I know in ProjectileHitEvent if the projectile hit another entity. For example, if after the projectilehitevent, the entitydamagebyentity event is called right after it. Checking ProjectileHitEvent is a instance of EntityDamageByEntityEvent doesn't work.
     
  2. Offline

    Wick

    What version are you working with? In later iterations of spigot the ProjectileHitEvent has getHitEntity(). If you're on an older version, why not just use EntityDamageByEntityEvent? Is there anything that the EntityDamageByEntityEvent doesn't have?
     
    Chr0mosom3 likes this.
  3. Offline

    Chr0mosom3

    Thank you so much, I didn't know this existed!
    If the projectile doesn't hit a entity and just crashes on the ground the event isn't gonna get called, in contrast ProjectileHitEvent is called whenever any projectile hits anything.
     

Share This Page