コード例 #1
0
 /**
  * @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();
 }
コード例 #2
0
 /**
  * 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);
             }
         }
     }
 }