当前位置: 首页>>代码示例>>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;未经允许,请勿转载。