/** * @param Event $event */ public function callEvent(Event $event) { if ($event instanceof Cancellable and $event->isCancelled() and $this->isIgnoringCancelled()) { return; } $this->timings->startTiming(); $this->executor->execute($this->listener, $event); $this->timings->stopTiming(); }
/** * Calls an event * * @param Event $event */ public function callEvent(Event $event) { foreach ($event->getHandlers()->getRegisteredListeners() as $registration) { if (!$registration->getPlugin()->isEnabled()) { continue; } try { $registration->callEvent($event); } catch (\Exception $e) { $this->server->getLogger()->critical($this->server->getLanguage()->translateString("BukkitPE.plugin.eventError", [$event->getEventName(), $registration->getPlugin()->getDescription()->getFullName(), $e->getMessage(), get_class($registration->getListener())])); $logger = $this->server->getLogger(); if ($logger instanceof MainLogger) { $logger->logException($e); } } } }