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


PHP Player::setNameTag方法代码示例

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


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

示例1: setTeamSelectionItems

 public function setTeamSelectionItems(Player $player, $arena)
 {
     $player->getInventory()->clearAll();
     $player->setNameTag($player->getName());
     $teams = $this->getTeams($arena);
     foreach ($teams as $team) {
         $teamwool = $this->getWoolDamageByTeam($team);
         $player->getInventory()->addItem(Item::get(Item::WOOL, $teamwool, 1));
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:10,代码来源:Bedwars.php

示例2: unhide

 public function unhide(Player $player)
 {
     $player->setNameTag($player->getName());
     $player->sendMessage("[HideTag] Your NameTag has been unhidden!");
 }
开发者ID:kinect3000,项目名称:HideTag,代码行数:5,代码来源:Tag.php

示例3: formatterPlayerDisplayName

 public function formatterPlayerDisplayName(Player $p)
 {
     $prefix = null;
     $playerPrefix = $this->prefix()->get($p->getName() . ".prefix");
     if ($playerPrefix != null) {
         $prefix = $playerPrefix;
     } else {
         //use default prefix
         $prefix = $this->getConfig()->get("default-player-prefix");
     }
     //default to regular name
     $p->setNameTag($p->getName());
     return;
 }
开发者ID:AndreyNazarchuk,项目名称:Collection-Plugins-PocketMine-Prax,代码行数:14,代码来源:EventListener.php

示例4: handlePlayerQuit

 /**
  * Handle Player Disconnect, Death or Kicked
  *
  * @param Player $player        	
  */
 public function handlePlayerQuit(Player $player)
 {
     // @fix1
     // check if the player
     if (isset($this->getPlugIn()->redTeamPlayers[$player->getName()])) {
         $msg = $player->getName() . $this->getMsg("team.left-red");
         $player->getServer()->broadcastMessage($msg);
         unset($this->getPlugIn()->redTeamPlayers[$player->getName()]);
         $player->setNameTag($player->getName());
         // check if this player has the flag
         if ($player->getInventory()->contains(new Item(Item::CARPET))) {
             // put this flag back to team
             // assume red team only enermy flag - blue team
             $msg = TextFormat::GRAY . $player->getName() . " [" . $this->getMsg("ctf.return-flag") . "]";
             $player->getServer()->broadcastMessage($msg);
             $this->getBuilder()->addBlueTeamFlag($player->getLevel(), Item::CARPET, 11);
             // remove it from player
             $player->getInventory()->remove(new Item(Item::CARPET));
         }
     }
     if (isset($this->getPlugIn()->blueTeamPlayers[$player->getName()])) {
         $msg = TextFormat::WHITE . $player->getName() . $this->getMsg("team.left-blue");
         //player left
         $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->blueTeamPlayers);
         $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->redTeamPlayers);
         unset($this->getPlugIn()->blueTeamPlayers[$player->getName()]);
         $player->setNameTag($player->getName());
         if ($player->getInventory()->contains(new Item(Item::CARPET))) {
             // put this flag back to team
             $msg = TextFormat::WHITE . $player->getName() . " [" . $this->getMsg("ctf.return-flag") . "]";
             //$player->getServer ()->broadcastMessage ( $msg );
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->blueTeamPlayers);
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->redTeamPlayers);
             $this->getBuilder()->addRedTeamFlag($player->getLevel(), Item::CARPET, 14);
             // remove it from player
             $player->getInventory()->remove(new Item(Item::CARPET));
         }
     }
     if ($this->getPlugIn()->gameMode > 0) {
         // auto stop the game and declare winner if no team member left in anyone team
         if (count($this->getPlugIn()->redTeamPlayers) == 0 && count($this->getPlugIn()->blueTeamPLayers) > 0) {
             $message = TextFormat::WHITE . $this->getMsg("team.red-no-players");
             //$player->getServer ()->broadcastMessage ( $message );
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->blueTeamPlayers);
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->redTeamPlayers);
             // blue team win
             $this->getPlugIn()->blueTeamWins++;
             $this->handleStopTheGame();
             $this->handleBroadcastFinalScore($player, true);
         } elseif (count($this->getPlugIn()->redTeamPlayers) > 0 && count($this->getPlugIn()->blueTeamPLayers) == 0) {
             $message = TextFormat::WHITE . $this->getMsg("team.blue-no-players");
             //$player->getServer ()->broadcastMessage ( $message );
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->blueTeamPlayers);
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->redTeamPlayers);
             // red team win
             $this->getPlugIn()->redTeamWins++;
             $this->handleStopTheGame();
             $this->handleBroadcastFinalScore($player, true);
         } elseif (count($this->getPlugIn()->redTeamPlayers) == 0 && count($this->getPlugIn()->blueTeamPLayers) == 0) {
             $message = TextFormat::WHITE . $this->getMsg("team.no-players");
             //$player->getServer ()->broadcastMessage ( $message );
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->blueTeamPlayers);
             $player->getServer()->broadcastMessage($msg, $this->getPlugIn()->redTeamPlayers);
             // draw
             $this->handleStopTheGame();
             $this->handleBroadcastFinalScore($player, true);
         }
     }
 }
开发者ID:JiangsNetworkAlpha,项目名称:CaptureTheFlag,代码行数:74,代码来源:CTFManager.php

示例5: handlePlayerJoinTap

 public function handlePlayerJoinTap(Player $player, $block)
 {
     $posKey = round($block->x) . "." . round($block->y) . "." . round($block->z);
     if (isset($this->npcsPositions[$posKey])) {
         $npc = $this->npcsPositions[$posKey];
         $data = $this->plugin->profileprovider->retrievePlayerByName($player->getName());
         if ($npc->kitName == "vip_kit") {
             $player->sendMessage("[HG] VIP only!");
         } else {
             if ($data == null || count($data) == 0) {
                 $this->plugin->profileprovider->addPlayer($player->getName());
                 $data = $this->plugin->profileprovider->retrievePlayerByName($player->getName());
             }
             $player->setNameTag($player->getName());
         }
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:17,代码来源:StatueManager.php

示例6: formatterPlayerDisplayName

 public function formatterPlayerDisplayName(Player $p)
 {
     $prefix = null;
     $this->playerConfig = new Config($this->path . "players/" . $p->getName() . ".yml", Config::YAML);
     $playerPrefix = $this->playerConfig->get($p->getName() . ".prefix");
     if ($playerPrefix != null) {
         $prefix = $playerPrefix;
     } else {
         //use default prefix
         $prefix = $this->config->get("default-player-prefix");
     }
     //check if player has nick name
     $nick = $this->playerConfig->get($p->getName() . ".nick");
     if ($nick != null && $prefix != null) {
         $p->setNameTag($prefix . ":" . $nick);
         return;
     }
     if ($nick != null && $prefix == null) {
         $p->setNameTag($nick);
         return;
     }
     if ($nick == null && $prefix != null) {
         $p->setNameTag($prefix . ":" . $p->getName());
         return;
     }
     //default to regular name
     $p->setNameTag($p->getName());
     return;
     $tags = null;
     $playerPrefix = $this->playerConfig->get($p->getName() . ".tags");
     if ($playerTags != null) {
         $tags = $playerTags;
     } else {
         //use default prefix
         $tags = $this->config->get("default-player-tags");
     }
 }
开发者ID:AndreyNazarchuk,项目名称:Collection-Plugins-PocketMine-Prax,代码行数:37,代码来源:ccMain.php

示例7: initialEntity

 public function initialEntity(Player $player)
 {
     assert($player->namedtag instanceof CompoundTag);
     if (isset($player->namedtag->ActiveEffects)) {
         foreach ($player->namedtag->ActiveEffects->getValue() as $e) {
             $effect = Effect::getEffect($e["Id"]);
             if ($effect === null) {
                 continue;
             }
             $effect->setAmplifier($e["Amplifier"])->setDuration($e["Duration"])->setVisible($e["ShowParticles"] > 0);
             $player->addEffect($effect);
         }
     }
     if (isset($player->namedtag->CustomName)) {
         $player->setNameTag($player->namedtag["CustomName"]);
         if (isset($player->namedtag->CustomNameVisible)) {
             $player->setNameTagVisible($this->namedtag["CustomNameVisible"] > 0);
         }
     }
     $player->scheduleUpdate();
 }
开发者ID:organization,项目名称:SpawningPool,代码行数:21,代码来源:AuthenticateCallback.php


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