当前位置: 首页>>代码示例>>PHP>>正文


PHP CommandSender::getFloorZ方法代码示例

本文整理汇总了PHP中pocketmine\command\CommandSender::getFloorZ方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandSender::getFloorZ方法的具体用法?PHP CommandSender::getFloorZ怎么用?PHP CommandSender::getFloorZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\command\CommandSender的用法示例。


在下文中一共展示了CommandSender::getFloorZ方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 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;
 }
开发者ID:EmreTr1,项目名称:TNTRun,代码行数:10,代码来源:Pos2SubCmd.php

示例2: execute

 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;
 }
开发者ID:100henrik100,项目名称:TNTRun,代码行数:10,代码来源:Pos2SubCmd.php

示例3: execute

 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;
 }
开发者ID:100henrik100,项目名称:TNTRun,代码行数:31,代码来源:CreateSubCmd.php

示例4: execute

 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;
 }
开发者ID:EmreTr1,项目名称:TNTRun,代码行数:31,代码来源:CreateSubCmd.php

示例5: onCommand

 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");
                 }
         }
     }
 }
开发者ID:Rspuds,项目名称:AreaEffects,代码行数:41,代码来源:Main.php

示例6: onCommand

 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;
     }
 }
开发者ID:Calrizer,项目名称:Greenifier,代码行数:20,代码来源:Greenifier.php

示例7: onCommand

 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;
     }
 }
开发者ID:MrSN-AG,项目名称:TheMC-API,代码行数:51,代码来源:Main.php

示例8: onCommand

 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;
     }
 }
开发者ID:xHFx,项目名称:TreasureHunt-,代码行数:29,代码来源:Main.php


注:本文中的pocketmine\command\CommandSender::getFloorZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。