Exemplo n.º 1
0
 public function execute(CommandSender $sender, array $args)
 {
     if (!$sender instanceof Player) {
         $sender->sendMessage(TextFormat::YELLOW . "Please run this command in game!");
         return true;
     }
     $this->getMain()->selection[strtolower($sender->getName())]["pos2"] = ["x" => $sender->getFloorX(), "z" => $sender->getFloorZ(), "level" => $sender->getLevel()->getName()];
     $sender->sendMessage(TextFormat::GREEN . "Pos 2 set to : x=" . $sender->getFloorX() . ", z=" . $sender->getFloorZ() . ", level=" . $sender->getLevel()->getName());
     return true;
 }
Exemplo n.º 2
0
 public function execute(CommandSender $sender, array $args)
 {
     if (!$sender instanceof Player) {
         $sender->sendMessage($this->getMessage("error.in-game"));
         return true;
     }
     $this->getMain()->selection[strtolower($sender->getName())]["pos2"] = ["x" => $sender->getFloorX(), "z" => $sender->getFloorZ(), "level" => $sender->getLevel()->getName()];
     $sender->sendMessage($this->getMessage("commands.pos2.set", ["POS" => "x=" . $sender->getFloorX() . ", z=" . $sender->getFloorZ() . ", level=" . $sender->getLevel()->getName()]));
     return true;
 }
Exemplo n.º 3
0
 public function execute(CommandSender $sender, array $args)
 {
     if (!$sender instanceof Player) {
         $sender->sendMessage($this->getMessage("error.in-game"));
         return true;
     }
     if (!isset($this->getMain()->selection[strtolower($sender->getName())]["pos1"])) {
         $sender->sendMessage($this->getMessage("commands.create.error.pos1"));
         return true;
     }
     if (!isset($this->getMain()->selection[strtolower($sender->getName())]["pos2"])) {
         $sender->sendMessage($this->getMessage("commands.create.error.pos1"));
         return true;
     }
     if ($this->getMain()->selection[strtolower($sender->getName())]["pos1"]["level"] !== $this->getMain()->selection[strtolower($sender->getName())]["pos2"]["level"]) {
         $sender->sendMessage($this->getMessage("commands.create.error.pos"));
         return true;
     }
     if (!isset($this->getMain()->selection[strtolower($sender->getName())]["floors"])) {
         $sender->sendMessage($this->getMessage("commands.create.error.floor"));
         return true;
     }
     if (!isset($args[0])) {
         $sender->sendMessage($this->getMessage("commands.create.error.arena"));
         return true;
     }
     $this->getMain()->arenas[strtolower($args[0])] = new Arena($this->getMain(), ["name" => $args[0], "pos1" => ["x" => $this->getMain()->selection[strtolower($sender->getName())]["pos1"]["x"], "z" => $this->getMain()->selection[strtolower($sender->getName())]["pos1"]["z"]], "pos2" => ["x" => $this->getMain()->selection[strtolower($sender->getName())]["pos2"]["x"], "z" => $this->getMain()->selection[strtolower($sender->getName())]["pos2"]["z"]], "floors" => $this->getMain()->selection[strtolower($sender->getName())]["floors"], "levelName" => $this->getMain()->selection[strtolower($sender->getName())]["pos1"]["level"], "spawn" => ["x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ()]]);
     $sender->sendMessage($this->getMessage("commands.create.error.arena"));
     unset($this->getMain()->selection[strtolower($sender->getName())]);
     return true;
 }
Exemplo n.º 4
0
 public function execute(CommandSender $sender, array $args)
 {
     if (!$sender instanceof Player) {
         $sender->sendMessage(TextFormat::YELLOW . "Please run this command in game!");
         return true;
     }
     if (!isset($this->getMain()->selection[strtolower($sender->getName())]["pos1"])) {
         $sender->sendMessage(TextFormat::RED . "Please specify pos 1 first");
         return true;
     }
     if (!isset($this->getMain()->selection[strtolower($sender->getName())]["pos2"])) {
         $sender->sendMessage(TextFormat::RED . "Please specify pos 2 first");
         return true;
     }
     if ($this->getMain()->selection[strtolower($sender->getName())]["pos1"]["level"] !== $this->getMain()->selection[strtolower($sender->getName())]["pos2"]["level"]) {
         $sender->sendMessage(TextFormat::RED . "Positions are in different levels");
         return true;
     }
     if (!isset($this->getMain()->selection[strtolower($sender->getName())]["floors"])) {
         $sender->sendMessage(TextFormat::RED . "Select floors first");
         return true;
     }
     if (!isset($args[0])) {
         $sender->sendMessage(TextFormat::RED . "Please specify an arena name");
         return true;
     }
     $this->getMain()->arenas[strtolower($args[0])] = new Arena($this->getMain(), ["name" => $args[0], "pos1" => ["x" => $this->getMain()->selection[strtolower($sender->getName())]["pos1"]["x"], "z" => $this->getMain()->selection[strtolower($sender->getName())]["pos1"]["z"]], "pos2" => ["x" => $this->getMain()->selection[strtolower($sender->getName())]["pos2"]["x"], "z" => $this->getMain()->selection[strtolower($sender->getName())]["pos2"]["z"]], "floors" => $this->getMain()->selection[strtolower($sender->getName())]["floors"], "levelName" => $this->getMain()->selection[strtolower($sender->getName())]["pos1"]["level"], "spawn" => ["x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ()]]);
     $sender->sendMessage(TextFormat::GREEN . "Arena created. Spawn pos set to current location");
     unset($this->getMain()->selection[strtolower($sender->getName())]);
     return true;
 }
Exemplo n.º 5
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $this->configFile = new Config($this->getDataFolder() . "areas.yml", Config::YAML, array());
     if ($command == "ae") {
         switch ($args[0]) {
             case "pos1":
                 if ($sender instanceof Player) {
                     $pos1x = $sender->getFloorX();
                     $pos1y = $sender->getFloorY();
                     $pos1z = $sender->getFloorZ();
                     $this->pos1 = new \pocketmine\math\Vector3($pos1x, $pos1y, $pos1z);
                     $sender->sendMessage(TextFormat::GREEN . "[AreaEffects]Possition 1 set as x:" . $pos1x . " y:" . $pos1y . " z:" . $pos1z);
                     return true;
                     break;
                 }
             case "pos2":
                 if ($sender instanceof Player) {
                     $pos2x = $sender->getFloorX();
                     $pos2y = $sender->getFloorY();
                     $pos2z = $sender->getFloorZ();
                     $this->pos2 = new \pocketmine\math\Vector3($pos2x, $pos2y, $pos2z);
                     $sender->sendMessage(TextFormat::GREEN . "[AreaEffects]Possition 2 set as x:" . $pos2x . " y:" . $pos2y . " z:" . $pos2z);
                     return true;
                     break;
                 }
             case "create":
                 if ($sender instanceof Player) {
                     if (isset($args[1], $args[2])) {
                         if (isset($this->pos1, $this->pos2)) {
                             $this->areas[$args[1]] = array('pos1' => array('x' => $this->pos1->x, 'y' => $this->pos1->y, 'z' => $this->pos1->z), 'pos2' => array('x' => $this->pos2->x, 'y' => $this->pos2->y, 'z' => $this->pos2->z), 'effect' => array('id' => $args[2], 'duration' => 10, 'amplifier' => 0, 'show' => true));
                             $sender->sendMessage(TextFormat::GREEN . "[AreaEffects]Area created");
                             return true;
                             break;
                         }
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "this command must be used in-game");
                 }
         }
     }
 }
Exemplo n.º 6
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "greenify":
             if (count($args) !== 0) {
                 $sender->sendMessage(TextFormat::RED . "Usage: " . $command->getUsage());
                 return true;
             }
             $sender->sendMessage("Prepare for a lag spike!");
             $level = $sender->getLevel();
             $playerX = $sender->getFloorX();
             $playerZ = $sender->getFloorZ();
             for ($x = $playerX - 100; $x <= $playerX + 100; $x++) {
                 for ($z = $playerZ - 100; $z <= $playerZ + 100; $z++) {
                     $level->setBiomeColor($x, $z, 127, 169, 76);
                 }
             }
             return true;
     }
 }
Exemplo n.º 7
0
 public function onCommand(CommandSender $entity, Command $cmd, $label, array $args)
 {
     $level = $this->getServer()->getDefaultLevel();
     $x = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getX();
     $y = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getY();
     $z = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getZ();
     switch ($cmd->getName()) {
         case "info":
             if ($entity instanceof Player) {
                 if ($entity->hasPermission("fapi.prm.info")) {
                     $name = $entity->getName();
                     if ($entity->hasPermission("fapi.prm.vip")) {
                         $group = "GUEST";
                     } elseif ($entity->hasPermission("fapi.prm.prem")) {
                         $group = "VIP";
                     } elseif ($entity->hasPermission("fapi.prm.creat")) {
                         $group = "GM";
                     } elseif ($entity->hasPermission("fapi.prm.moder")) {
                         $group = "ADMIN";
                     } elseif ($entity->hasPermission("fapi.prm.admin")) {
                         $group = "OWNER";
                     } elseif ($entity->hasPermission("fapi.prm.gladm")) {
                         $group = "OP";
                     } elseif ($entity->hasPermission("fapi.prm.owner")) {
                         $group = "Основатель";
                     } else {
                         $group = "GUEST";
                     }
                 } else {
                     $entity->sendMessage(F::RED . "Тебе не доступна данная команда!");
                 }
                 $name = $entity->getName();
                 $money = $this->eco->mymoney($name);
                 $kills = $this->getKills($name);
                 $death = $this->getDeaths($name);
                 $plus = 3;
                 $datemsk = gmdate("H:i:s", time() + $plus * 3600);
                 $x = $entity->getFloorX();
                 $y = $entity->getFloorY();
                 $z = $entity->getFloorZ();
                 $entity->sendMessage(F::YELLOW . "Ваш ник: " . F::AQUA . "{$name}");
                 $entity->sendMessage(F::YELLOW . "Ваш баланс: " . F::GOLD . "{$money}" . F::YELLOW . "\$");
                 $entity->sendMessage(F::YELLOW . "Ваши права: " . F::DARK_AQUA . "{$group}");
                 $entity->sendMessage(F::YELLOW . "Сейчас время: " . F::GREEN . "{$datemsk} " . F::GRAY . "(МСК)");
                 $entity->sendMessage(F::YELLOW . "Ваши киллы: " . F::RED . "{$kills}");
                 $entity->sendMessage(F::YELLOW . "Ваши смерти: " . F::RED . "{$death}");
                 $entity->sendMessage(F::YELLOW . "Ваши координаты: " . F::RED . "{$x}, {$y}, {$z}");
             }
             break;
     }
 }
Exemplo n.º 8
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "tclear":
             $this->chests = array();
             $level = $sender->getLevel();
             $entities = $level->getEntities();
             $tiles = $level->getTiles();
             $x = $sender->getFloorX();
             $z = $sender->getFloorZ();
             foreach ($entities as $entity) {
                 $level->removeEntity($entity);
                 $sender->sendMessage('[' . $entity->getId() . '] -  ' . $entity->getFloorX() . '.' . $entity->getFloorY() . '.' . $entity->getFloorZ() . ' deleted');
             }
             foreach ($tiles as $tile) {
                 $level->removeTile($tile);
                 if ($tile instanceof Chest) {
                     $tile->getInventory()->clearAll();
                 }
                 $sender->sendMessage('[' . $tile->getBlock()->getName() . '] at ' . $tile->getFloorX() . '.' . $tile->getFloorY() . '.' . $tile->getFloorZ() . ' deleted');
             }
             $level->chunkHash($x, $z);
             $level->unloadChunk($x, $z, false);
             $level->clearCache();
             $level->loadChunk($x, $z, true);
             $level->regenerateChunk($x, $z);
             return true;
     }
 }