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


PHP Player::getLocation方法代碼示例

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


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

示例1: getMaskLocation

 public function getMaskLocation(Player $player)
 {
     // always return player current location if there is an error
     if (!$this->maskLoc) {
         return $player->getLocation();
     }
     if (!preg_match('#^((\\?spawn\\?)|((\\-)?[0-9]+,(\\-)?[0-9]+,(\\-)?[0-9]+))@([^/\\\\]+)$#', $this->maskLocPos, $match)) {
         return $player->getLocation();
     }
     $pos = $match[1];
     $world = $match[7];
     $level = $player->getLevel();
     if ($world === "?default?") {
         $level = $player->getServer()->getDefaultLevel();
     } elseif ($world !== "?current?") {
         $level = $player->getServer()->getLevelByName($world);
         if (!$level instanceof Level) {
             $level = $player->getLevel();
         }
     }
     if ($pos === "?spawn?") {
         $position = $level->getSpawnLocation();
     } else {
         list($x, $y, $z) = explode(",", $pos);
         $position = new Position((int) $x, (int) $y, (int) $z, $level);
     }
     return $position;
 }
開發者ID:EpicArtz08999,項目名稱:HereAuth,代碼行數:28,代碼來源:AccountOpts.php

示例2: getLocation

 public function getLocation()
 {
     return $this->player->getLocation();
 }
開發者ID:GoneTone,項目名稱:WorldEditArt,代碼行數:4,代碼來源:PlayerSession.php

示例3: addSpawn

 public function addSpawn(Player $player)
 {
     $this->getLevelConfig();
     $location = $player->getLocation();
     $lobby = strtolower($player->getLevel()->getName());
     if ($this->level->getNested($lobby . ".spawns") !== null) {
         $spawns = $this->level->getNested($lobby . ".spawns");
         $count = count(array_keys($spawns));
     } else {
         $count = 0;
     }
     $this->level->setNested($lobby . ".spawns." . $count, array("x" => round($location->getFloorX(), 0), "y" => round($location->getFloorY(), 0), "z" => round($location->getFloorZ(), 0)));
     $this->setLevelConfig();
     $player->sendMessage(TextFormat::GREEN . "Spawn set");
     return true;
 }
開發者ID:Edwardthedog2,項目名稱:SpleefPE,代碼行數:16,代碼來源:Main.php

示例4: touch

 public function touch(Player $damager, Player $entity)
 {
     $damagerGameId = $this->players[$damager->getName()];
     $entityGameId = $this->players[$entity->getName()];
     if ($damagerGameId === $entityGameId && $damagerGameId !== "NONE") {
         $returnVal = $this->games[$damagerGameId]->touch($damager->getName(), $entity->getName());
         switch ($returnVal) {
             case GameManager::RETURNTYPE_TOUCH_ALREADY_TOUCED_FAILED:
                 $damager->sendMessage(TextFormat::RED . $this->getTranslation("TOUCH_ALREADY_TOUCHED"));
                 break;
             case GameManager::RETURNTYPE_TOUCH_IN_PREPARATION_OR_REST_FAILED:
                 $damager->sendMessage(TextFormat::RED . $this->getTranslation("PREPARATION_OR_REST"));
                 break;
             case GameManager::RETURNTYPE_TOUCH_SUCCEED:
                 $this->notifyTipForPlayers($damagerGameId, TextFormat::DARK_PURPLE . $this->getTranslation("TOUCH_MESSAGE", $damager->getName(), $entity->getName()));
                 $this->notifyForPlayers($damagerGameId, TextFormat::DARK_PURPLE . $this->getTranslation("TOUCH_MESSAGE", $damager->getName(), $entity->getName()));
                 $this->createTouchEffect($entity->getLocation(), $entity->getEyeHeight(), $damager->getLocation(), $damager->getEyeHeight());
                 break;
         }
         return $returnVal;
     }
     return false;
 }
開發者ID:EpicArtz08999,項目名稱:ZombieGame,代碼行數:23,代碼來源:GameGenius.php


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