public function onUpdate($currentTick) { if ($this->closed) { return false; } $this->timings->startTiming(); $hasUpdate = parent::onUpdate($currentTick); if (!$this->hadCollision and $this->isCritical) { $this->level->addParticle(new CriticalParticle($this->add($this->width / 2 + mt_rand(-100, 100) / 500, $this->height / 2 + mt_rand(-100, 100) / 500, $this->width / 2 + mt_rand(-100, 100) / 500))); } elseif ($this->onGround) { $this->isCritical = false; } if ($this->age > 1200 or $this->isCollided) { $hasUpdate = true; if ($this->isCollided and $this->canExplode) { $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 2.8)); if (!$ev->isCancelled()) { $explosion = new Explosion($this, $ev->getForce(), $this->shootingEntity); if ($ev->isBlockBreaking()) { $explosion->explodeA(); } $explosion->explodeB(); } } $this->kill(); } $this->timings->stopTiming(); return $hasUpdate; }
public function explode() { $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 4)); if (!$ev->isCancelled()) { $explosion = new Explosion($this, $ev->getForce(), $this); if ($ev->isBlockBreaking()) { $explosion->explodeA(); } $explosion->explodeB(); } }
public function onRun($currentTick) { if ($this->event->isCancelled()) { return; } $arrow = $this->event->getEntity(); $murder = $this->event->getEntity()->shootingEntity; if (!$arrow instanceof Arrow) { return; } if (!$murder instanceof Player) { return; } $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($arrow, 3.2)); if (!$ev->isCancelled()) { $arrow->getLevel()->addParticle(new MobSpawnParticle($arrow, 2, 2)); $explosion = new Explosion($arrow, $ev->getForce(), $murder); $explosion->explodeB(); } $reflection_class = new \ReflectionClass($arrow); $property = $reflection_class->getProperty('age'); $property->setAccessible(true); $property->setValue($arrow, 7000); }
public function removeArrow(Event $event) { if ($event->isCancelled()) { return; } $arrow = $event->getEntity(); $murder = $event->getEntity()->shootingEntity; $this->getServer()->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($arrow, 3.2)); if (!$ev->isCancelled()) { $explosion = new Explosion($arrow, $ev->getForce(), $murder); $explosion->explodeB(); } $reflection_class = new \ReflectionClass($arrow); $property = $reflection_class->getProperty('age'); $property->setAccessible(true); $property->setValue($arrow, 7000); }
public function SoldierGame(Entity $entity) { if ($this->checkEnableSoldierGame() and $entity->shootingEntity instanceof Player) { $this->getServer()->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($entity, 2.5)); if (!$ev->isCancelled()) { $explosion = new Explosion($entity, $ev->getForce(), $entity->shootingEntity); $explosion->explodeB(); } } }