Пример #1
0
 public function onCommand(CommandSender $player, Command $command, $label, array $args)
 {
     // - 명령어처리용
     if (strtolower($command) == $this->db->get("explode")) {
         // TODO <- 빈칸에 명령어
         if (!isset($args[0])) {
             // 유저명을 안 적었을때 도움말 뛰우기
             $this->db->alert($player, $this->db->get("explode-help"));
             return true;
         }
         // $arg[0] 값으로 유저를 찾음
         $target = $this->getServer()->getPlayer($args[0]);
         // 유저가 없으면 유저를 못 찾았다고 예외처리
         if (!$target instanceof Player) {
             $this->db->alert($player, $this->db->get("cant-find-player"));
             return true;
         }
         // 유저를 찾았으면 유저주변에 폭발처리
         for ($i = 1; $i <= 5; $i++) {
             $x = $target->x + mt_rand(-15, 15);
             $y = $target->y;
             $z = $target->z + mt_rand(-15, 15);
             $explosion = new Explosion(new Position($x, $y, $z, $target->getLevel()), 5);
             $explosion->explodeA();
             $explosion->explodeB();
         }
         $this->db->message($player, $this->db->get("explode-success"));
         return true;
     }
 }
Пример #2
0
 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();
     }
 }
Пример #3
0
 public function updateFuse()
 {
     if ($this->closed === true) {
         return false;
     }
     if ($this->type === OBJECT_PRIMEDTNT) {
         $this->updateMetadata();
         if ((microtime(true) - $this->spawntime) * 20 >= $this->data["fuse"]) {
             $this->close();
             $explosion = new Explosion($this, $this->data["power"]);
             $explosion->explode();
         }
     }
 }