Check if player damaged an entity in EntityDamageEvent?

Discussion in 'Spigot Plugin Development' started by kinukin, Jun 12, 2017.

  1. How can I check if a player damaged an entity in EntityDamageEvent?

    Thank you
     
  2. use EntityDamageByEntityEvent and check if damager is player


    Sent from my iPhone using Tapatalk
     
    • Agree Agree x 1
    • Funny Funny x 1
  3. You basically repeated what he said :p , and the answer is the make an if statement checking if event.getKiller() is instance of Player
     
  4. Use the EntityDamageByEntityEvent and check if the e.getDamager() is the instance of a Entity. If so, cast Entity to e.getDamager().