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 blowPlayer($pl, $yield, $magic)
 {
     $this->owner->getServer()->getPluginManager()->callEvent($cc = new ExplosionPrimeEvent($pl, $yield));
     if ($cc->isCancelled()) {
         return false;
     }
     $explosion = new Explosion($pl, $yield);
     if (!$magic) {
         $explosion->explodeA();
     }
     $explosion->explodeB();
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "blowup") {
         return false;
     }
     if (count($args) == 0) {
         return false;
     }
     $pl = $this->owner->getServer()->getPlayer($args[0]);
     if (!$pl) {
         $sender->sendMessage(mc::_("%1% not found.", $args[0]));
         return true;
     }
     array_shift($args);
     $yield = 5;
     $magic = false;
     foreach ($args as $i) {
         if (is_numeric($i)) {
             $yield = intval($i);
             if ($yield < 1) {
                 $yield = 1;
             }
         } elseif (strtolower($i) == "magic") {
             $magic = true;
         } elseif (strtolower($i) == "normal") {
             $magic = false;
         }
     }
     $this->owner->getServer()->getPluginManager()->callEvent($cc = new ExplosionPrimeEvent($pl, $yield));
     if ($cc->isCancelled()) {
         return true;
     }
     $explosion = new Explosion($pl, $yield);
     if (!$magic) {
         $explosion->explodeA();
     }
     $explosion->explodeB();
     return true;
 }
 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);
 }
Exemple #6
0
 public function akira($n, $pos, $magic, $yield)
 {
     $this->getServer()->broadcastMessage("AAAAKIIIIIRAAAAA!!!!!");
     $source = $this->getServer()->getPlayer($n);
     $this->getServer()->getPluginManager()->callEvent($cc = new ExplosionPrimeEvent($source, $yield));
     if ($cc->isCancelled()) {
         //echo("Cancelled\n");//##DEBUG
         return;
     }
     $explosion = new Explosion($pos, $yield);
     if (!$magic) {
         $explosion->explodeA();
     }
     $explosion->explodeB();
 }
Exemple #7
0
 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);
 }
Exemple #8
0
 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();
         }
     }
 }