/** * @param EntityExplodeEvent $event * * @priority HIGH * @ignoreCancelled true */ public function onEntityExplode(EntityExplodeEvent $event) { if ($this->plugin->getConfig()->get("protect-from-explosion", true) != true) { return; } $radius = $this->plugin->getConfig()->get("explosion-radius", 8); foreach ($this->plugin->getAllZones() as $zone) { if ($zone->isOnRadius($event->getPosition(), $radius)) { $owner = $this->plugin->getServer()->getPlayer($zone->getOwner()); if ($owner instanceof Player) { $owner->sendMessage('[iZone] Something explode near zone: ' . $zone->getName()); } $event->setCancelled(true); break; } } return; }