How can i fix PHP: public function onDamage(EntityDamageEvent $event){ if($event->getEntity() instanceof Player){ if(isset($this->iswildin[$event->getEntity->getName()])){ $p = $event->getEntity(); unset($this->iswildin[$p->getName()]); $event->setCancelled(); } } }}
Please specify the error if you just tell how can i fix we dont know the problem and What do You think about using the [ PHP]
Be sure your class is registered as an event listener. You're code looks fine, ensure you are pushing the players name to the "iswildin" array. An alternative would be to teleport the player to a spot ontop of a block (not randomly in the air).