當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommandSender::getLocation方法代碼示例

本文整理匯總了PHP中pocketmine\command\CommandSender::getLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandSender::getLocation方法的具體用法?PHP CommandSender::getLocation怎麽用?PHP CommandSender::getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\command\CommandSender的用法示例。


在下文中一共展示了CommandSender::getLocation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 public function execute(CommandSender $sender, $label, array $params)
 {
     if (!$this->plugin->isEnabled()) {
         return false;
     }
     if (!$sender instanceof Player) {
         $sender->sendMessage("Please use the command in-game");
         return true;
     }
     // Get current op location
     $playerLocation = $sender->getLocation();
     $this->plugin->getLogger()->info("location" . $sender->getLocation());
     // Add the arena
     $this->arenaManager->referenceNewArena($playerLocation);
     // Notify the op
     $sender->sendMessage("[1vs1] A new arena has been created at your position ! There are " . $this->arenaManager->getNumberOfArenas() . " arenas.");
     return true;
 }
開發者ID:TDMGamingMC,項目名稱:pocketmine-1vs1-plugin,代碼行數:18,代碼來源:ReferenceArenaCommand.php

示例2: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "prison":
             if ($sender instanceof Player) {
                 if (count($args) == "help") {
                     // prison random
                     // prison exit
                     // prison arena
                     // prison kit
                     // prison info
                     $sender->sendMessage(TextFormat::GREEN . "Prison command" . TextFormat::YELLOW . "\n" . "use /prison random -> teleport to random cell" . "\n" . "/prison exit -> teleport to lobby" . "/n" . "/prison arena -> teleport to arena pvp" . "/n" . "/prison kit <name> -> give kit for survival" . "/n" . "/prison info <kit> -> give info in chat a player");
                 } else {
                     if (count($args) == "random") {
                         $event->getPlayer()->teleport($this->getRandomLocation());
                     } else {
                         if (count($args) == "exit") {
                             $this->getServer()->getPlayer()->teleport(new Vector3($this->yml["lobby_x"], $this->yml["lobby_y"], $this->yml["lobby_z"]));
                         } else {
                             if (count($args) == "arena") {
                                 $this->getServer()->getPlayer()->teleport(new Vector3($this->yml["arena_x"], $this->yml["arena_y"], $this->yml["arena_z"]));
                             } else {
                                 if (count($args) == "kit") {
                                     if ($this->getServer()->getPlayer() == "robozeri" || "owner" || "altro") {
                                         $sword = Item::get(276, 1, 1);
                                         $armor1 = Item::get(310, 1, 1);
                                         $armor2 = Item::get(311, 1, 1);
                                         $armor3 = Item::get(312, 1, 1);
                                         $armor4 = Item::get(313, 1, 1);
                                         $player->getInventory()->addItem($sword);
                                         $player->getInventory()->addItem($armor1);
                                         $player->getInventory()->addItem($armor2);
                                         $player->getInventory()->addItem($armor3);
                                         $player->getInventory()->addItem($armor4);
                                     } else {
                                         $sword = Item::get(276, 1, 1);
                                         $armor1n = Item::get(310, 1, 1);
                                         $armor2n = Item::get(311, 1, 1);
                                         $armor3n = Item::get(312, 1, 1);
                                         $armor4n = Item::get(313, 1, 1);
                                         $player->getInventory()->addItem($sword);
                                         $player->getInventory()->addItem($armor1n);
                                         $player->getInventory()->addItem($armor2n);
                                         $player->getInventory()->addItem($armor3n);
                                         $player->getInventory()->addItem($armor4n);
                                     }
                                 }
                             }
                         }
                     }
                 }
                 return true;
             }
             break;
         case "setcell":
             $this->addNewLocation($sender->getLocation());
             $sender->sendMessage("added the xyz!");
             $sender->sendMessage("" . $this->getNumberOfPositions() . "POS.");
             return true;
             break;
     }
 }
開發者ID:iSoteristi,項目名稱:Prison,代碼行數:62,代碼來源:main.php

示例3: onCommand

 /**
 =+=+=+=+=+=+=+=
 
 >>>>> COMMANDS
 
 =+=+=+=+=+=+=+=
 **/
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         //rtpset command to set a random spawn position
         case "mtpset":
             $this->addNewLocation($sender->getLocation());
             $sender->sendMessage("[MultiTP] A new teleportation target was added at your position !");
             $sender->sendMessage("[MultiTP] There are : " . $this->getNumberOfPositions() . " teleportation targets.");
             return true;
             //rtpreset command to reset all random spawn positions
         //rtpreset command to reset all random spawn positions
         case "mtpreset":
             $this->resetPositions();
             $sender->sendMessage("[MultiTP] All random spawn positions have been removed!");
             return true;
             //rtpinfo to have all informations about the plugin :)
         //rtpinfo to have all informations about the plugin :)
         case "mtpinfo":
             $sender->sendMessage("[MultiTP] This plugin was created by Minifixio. I've got a Youtube channel, you can subscribe :)");
             $sender->sendMessage("[MultiTP] Commands : /mtpset ( to set a random spawn position )  and  /mtpreset ( to reset all random spawn positions.");
             $sender->sendMessage("[MultiTP] The default teleporting block is the sponge block, but you can change this in the code of the plugin.");
             $sender->sendMessage("[MultiTP] Perhaps there will be an update to modify the block of teleportation.");
             return true;
             $sender->sendMessage("[MultiTP] If you have suggestions or bugs, please report this to me !");
         default:
             return false;
     }
 }
開發者ID:Artide,項目名稱:pocketmine-multitp-plugin,代碼行數:35,代碼來源:MultiTP.php


注:本文中的pocketmine\command\CommandSender::getLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。