So, when I'm shooting an arrow, there is a server crash. Here are a mistake and my code. And I haven't got any ideas for solution. I need a player who causes damage to another player. Class EntityDamageByEntityEvent has got method getDamager(), but class EntityDamageEvent hasn't got it. PHP: public function onEntityDamageByEntity(EntityDamageByEntityEvent $evt) { $player = $evt->getDamager(); } Code: 23:03:25 [NOTICE] An E_RECOVERABLE_ERROR error happened: "Argument 1 passed to WinniePooh\WorldGuard\Main::onEntityDamageByEntity() must be an instance of pocketmine\event\entity\EntityDamageByEntityEvent, instance of pocketmine\event\entity\EntityDamageEvent given, called in /root/pm1.4/src/pocketmine/plugin/MethodEventExecutor.php on line 36 and defined" in "/plugins/worldguard_HC/src/WinniePooh/WorldGuard/Main" at line 205 Fatal error: Call to undefined method pocketmine\event\entity\EntityDamageEvent::getDamager() in /root/pm1.4/plugins/worldguard_HC/src/WinniePooh/WorldGuard/Main.php on line 88 23:03:25 [EMERGENCY] An unrecoverable error has occurred and the server has crashed. Creating a crash dump 23:03:25 [EMERGENCY] Please submit the "/root/pm1.4/CrashDump_Tue_Oct_7-23.03.25-MSK_2014.log" file to the Bug Reporting page. Give as much info as you can. I'm sorry for my english.
Thx for LDX. I think it isn't the best solution but there isn't any analogues. Here is a link: http://forums.pocketmine.net/posts/58135/ And code: PHP: public function onFight(EntityDamageEvent $event) { if($event instanceof EntityDamageByEntityEvent && $event->getDamager() instanceof Player) { $d = $event->getDamager(); } }
It is the best solution because you can't hook to EntityDamageByEntityEvent because it has no static property $handlerList.