Hello I made a plugin unsuccessfully However,I don't know what's going with it. Its keep saying " [Server thread/CRITICAL]: pocketmine\plugin\PluginException: "pocketmine\event\entity\EntityDamageByEntityEvent does not have a handler list" (EXCEPTION) in "/src/pocketmine/plugin/PluginManager" at line 790" I can't understand why would EntityDamgedByEntityEvent need EventExecutor Is there any update? Here is my code... PHP: use pocketmine\plugin\PluginBase;use pocketmine\plugin\EventExecutor;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\event\Listener;use pocketmine\event\entity\EntityDamageByEntityEvent;use pocketmine\utils\TextFormat as C;class vf extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(C::GOLD . "Loaded!"); }public function checkCombat(EntityDamageByEntityEvent $event) { if($event instanceof EntityDamageByEntityEvent) { $player = $event->getEntity(); $damager = $event->getDamager(); if($player instanceof Player && $damager instanceof Player) { $player->sendMessage(C::YELLOW . "(!)You are in combat!"); $damager->sendMessage(C::YELLOW . "(!)You are in combat!"); unset($this->check); } } }
EntityDamageByEntityEvent doesn't have a handler list, like it says. Use EntityDamageEvent, then check if its instanceof EntityDamageByEntityEvent, which you already do.
So in the EntityDamageByEntityEvent you are checking if its an instance of an EntityDamageByEntityEvent? OK, heres the corrected code PHP: use pocketmine\plugin\PluginBase;use pocketmine\plugin\EventExecutor;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\event\Listener;use pocketmine\event\entity\EntityDamageEvent;use pocketmine\event\entity\EntityDamageByEntityEvent;use pocketmine\utils\TextFormat as C;class vf extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(C::GOLD . "Loaded!"); }public function checkCombat(EntityDamageEvent $event) { if($event instanceof EntityDamageByEntityEvent) { $player = $event->getEntity(); $damager = $event->getDamager(); if($player instanceof Player && $damager instanceof Player) { $player->sendMessage(C::YELLOW . "(!)You are in combat!"); $damager->sendMessage(C::YELLOW . "(!)You are in combat!"); unset($this->check); } } } You must use EntityDamageEvent and check if its an instance of EntityDamageByEntityEvent.
Do we need a warning specialized for duplicated threads? Or do we need to make this forum like StackOverflow?