I dont see why this code dont work to set a player on fire when hit by a arrow ): PHP: Public function onArrowHit(ProjectileHitEvent $ev) { $victim = $ev->getEntity(); $shooter = $victim->getLastDamageCause(); if($shooter instanceof EntityDamageByEntityEvent){ $shooter = $shooter->getDamager(); if ($shooter instanceof Player) { if($shooter->hasPermission("power.tools")){ $victim->setOnFire(); } } else{ return false; } } else{ return false; }}}
You need to track the arrow from the moment it's shot till the minute it lands on the entity. You should use https://github.com/PocketMine/Pocke...cketmine/event/entity/EntityShootBowEvent.php to check when the arrow is shot and then you should store the variables. Until the EntityDamageByEntityEvent is called. Once that is called you should check the information with the variables from before.
That sounds more confusing than i hoped lol im a noobie at php i have no idea how to "track" a arrow..theres nothing like entityHitByArrow event? lol
Interesting point: what if the player left the server before the arrow hit? Also, ProjectileHitEvent is fired before EntityDamageEvent is fired, and without EntityDamageEvent being fired, calling getLastDamageCause is useless. You should use $projectile->shootingEntity.