/** * @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(); }
public function stopTiming() { if (PluginManager::$useTimings) { if (--$this->timingDepth !== 0 or $this->start === 0) { return; } $diff = microtime(true) - $this->start; $this->totalTime += $diff; $this->curTickTotal += $diff; $this->count++; $this->start = 0; if ($this->parent instanceof TimingsHandler) { $this->parent->stopTiming(); } } }
public function stopTiming() { if (PluginManager::$useTimings) { if (--$this->timingDepth !== 0 or $this->start === 0) { return; } $diff = \microtime(\true) - $this->start; $this->totalTime += $diff; $this->curTickTotal += $diff; ++$this->curCount; ++$this->count; $this->start = 0; if ($this->parent !== \null) { $this->parent->stopTiming(); } } }
public function onUpdate($currentTick) { if ($this->closed) { return false; } $tickDiff = max(1, $currentTick - $this->lastUpdate); $this->lastUpdate = $currentTick; $this->timings->startTiming(); $hasUpdate = $this->entityBaseTick($tickDiff); $this->updateMovement(); $this->timings->stopTiming(); //if($this->isStatic()) return $hasUpdate; //return !($this instanceof Player); }
public function onUpdate($currentTick) { if ($this->closed) { return false; } if (!$this->isAlive()) { ++$this->deadTicks; if ($this->deadTicks >= 10) { $this->despawnFromAll(); if (!$this->isPlayer) { $this->close(); } } return $this->deadTicks < 10; } $tickDiff = $currentTick - $this->lastUpdate; if ($tickDiff <= 0) { return false; } $this->lastUpdate = $currentTick; $this->timings->startTiming(); $hasUpdate = $this->entityBaseTick($tickDiff); $this->updateMovement(); $this->timings->stopTiming(); //if($this->isStatic()) return $hasUpdate; //return !($this instanceof Player); }