I am trying to get the damager from the EntityDamageEvent but I always get errors. I use $event->getDamager();
You can only get the damager if the EntityDamageEvent is an instance of the EntityDamageByEntityEvent or the EntityDamageByBlockEvent.
Sorry for replying late ;D PHP: if($event instanceof EntityDamageByEntityEvent){$damager = $event->getDamager();}