/** * @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 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); }