Hey folks, I'm writing a tag plugin (Tag! you're it!) which is riding on the EntityDamageByEntityEvent event i.e. public function onPlayerTag(EntityDamageByEntityEvent $event){ // do some stuff } but this doesn't work if the target is in Cmode as the event is cancelled before I get to listen to it. Is there some other way of detecting this player a touches player b events? Thanks, D
EntityDamageByEntityEvent is not an event that you should put in type hint. Look into PocketMine source, if there is public static $handlerList you can listen to that event, if no, you either need to use its superclasses instead or it isn't an event that is ever fired.
It's firing for me. The listener is working, however, it's cancelled for players in cmode before I ever see it (in player.php) if($this->isCreative() and $source->getCause() !== EntityDamageEvent::CAUSE_MAGIC and $source->getCause() !== EntityDamageEvent::CAUSE_SUICIDE and $source->getCause() !== EntityDamageEvent::CAUSE_VOID ){ $source->setCancelled(); } else { /**more stuff so I could do with something more useful. Is there not an event we can use for Player A touches Player b? I guess I could do it onMove but that doesn't seem ideal...
You can. If you have @ignoreCancelled false (as default), it will still listen to the event. But anyway you mustn't listen to EntityDamageEvent or other bugs will happen.
Awesome. Where would I put @ignoreCancelled ? Apologies, been writing pocketmine plugins for about 24 hours...