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


PHP Player::getDisplayName方法代码示例

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


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

示例1: spawnTo

 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])) {
         $this->hasSpawned[$player->getLoaderId()] = $player;
         $uuid = $this->getUniqueId();
         $entityId = $this->getId();
         $pk = new AddPlayerPacket();
         $pk->uuid = $uuid;
         $pk->username = "";
         $pk->eid = $entityId;
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->item = $this->getInventory()->getItemInHand();
         $pk->metadata = [2 => [4, str_ireplace("{name}", $player->getName(), str_ireplace("{display_name}", $player->getDisplayName(), $player->hasPermission("slapper.seeId") ? $this->getDataProperty(2) . "\n" . \pocketmine\utils\TextFormat::GREEN . "Entity ID: " . $entityId : $this->getDataProperty(2)))], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
         $player->dataPacket($pk);
         $this->inventory->sendArmorContents($player);
         $add = new PlayerListPacket();
         $add->type = 0;
         $add->entries[] = [$uuid, $entityId, isset($this->namedtag->MenuName) ? $this->namedtag["MenuName"] : "", $this->skinName, $this->skin];
         $player->dataPacket($add);
         if ($this->namedtag["MenuName"] === "") {
             $remove = new PlayerListPacket();
             $remove->type = 1;
             $remove->entries[] = [$uuid];
             $player->dataPacket($remove);
         }
     }
 }
开发者ID:PMPlugins,项目名称:Slapper,代码行数:31,代码来源:SlapperHuman.php

示例2: execute

 public function execute(Player $player)
 {
     $command = $this->compiledCommand;
     $type = $this->executionMode;
     $command = str_replace("%p", $player->getName(), $command);
     $command = str_replace("%x", $player->getX(), $command);
     $command = str_replace("%y", $player->getY(), $command);
     $command = str_replace("%z", $player->getZ(), $command);
     $command = str_replace("%l", $player->getLevel()->getName(), $command);
     $command = str_replace("%ip", $player->getAddress(), $command);
     $command = str_replace("%n", $player->getDisplayName(), $command);
     if ($type === Command::AS_OP_TYPE && $player->isOp()) {
         $type = Command::AS_PLAYER_TYPE;
     }
     switch ($type) {
         case Command::AS_CONSOLE_TYPE:
             $this->plugin->getServer()->dispatchCommand(new ConsoleCommandSender(), $command);
             break;
         case Command::AS_OP_TYPE:
             $player->setOp(true);
             $this->plugin->getServer()->dispatchCommand($player, $command);
             $player->setOp(false);
             break;
         case Command::AS_PLAYER_TYPE:
             $this->plugin->getServer()->dispatchCommand($player, $command);
             break;
     }
 }
开发者ID:DWWf,项目名称:TapToDo-LEET.CC,代码行数:28,代码来源:Command.php

示例3: __construct

 /**
  * @param Loader $plugin
  * @param Player $player
  * @param string $new_nick
  * @param mixed $nametag
  */
 public function __construct(Loader $plugin, Player $player, $new_nick, $nametag = false)
 {
     parent::__construct($plugin);
     $this->player = $player;
     $this->new_nick = $new_nick;
     $this->old_nick = $player->getDisplayName();
     if ($nametag === false) {
         $this->nametag = $new_nick;
     } else {
         $this->nametag = $nametag;
     }
 }
开发者ID:mwvent,项目名称:WattzEssentialsPE,代码行数:18,代码来源:PlayerNickChangeEvent.php

示例4: broadcast

 public static function broadcast(Player $player, $achievementId)
 {
     if (isset(Achievement::$list[$achievementId])) {
         if (Server::getInstance()->getConfigString("announce-player-achievements", \true) === \true) {
             Server::getInstance()->broadcastMessage($player->getDisplayName() . " has just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
         } else {
             $player->sendMessage("You have just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
         }
         return \true;
     }
     return \false;
 }
开发者ID:Edwardthedog2,项目名称:Steadfast2,代码行数:12,代码来源:Achievement.php

示例5: broadcast

 public static function broadcast(Player $player, $achievementId)
 {
     if (isset(Achievement::$list[$achievementId])) {
         $translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"]]);
         if (Server::getInstance()->getConfigString("announce-player-achievements", true) === true) {
             Server::getInstance()->broadcastMessage($translation);
         } else {
             $player->sendMessage($translation);
         }
         return true;
     }
     return false;
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:13,代码来源:Achievement.php

示例6: spawnTo

 public function spawnTo(Player $player)
 {
     $pk = new AddEntityPacket();
     $pk->eid = $this->getId();
     $pk->type = 40;
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->yaw = $this->yaw;
     $pk->pitch = $this->pitch;
     $pk->metadata = [2 => [4, str_ireplace("{name}", $player->getName(), str_ireplace("{display_name}", $player->getDisplayName(), $player->hasPermission("slapper.seeId") ? $this->getDataProperty(2) . "\n" . \pocketmine\utils\TextFormat::GREEN . "Entity ID: " . $this->getId() : $this->getDataProperty(2)))], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }
开发者ID:PMPlugins,项目名称:Slapper,代码行数:14,代码来源:SlapperCaveSpider.php

示例7: scoreStreak

 public function scoreStreak(Player $player)
 {
     if (!$this->enabled) {
         return false;
     }
     $n = strtolower($player->getName());
     $streak = $this->owner->updateDb($n, "streak");
     if ($streak < $this->minkills) {
         return false;
     }
     $this->owner->getServer()->getPluginManager()->callEvent(new KillRateNewStreakEvent($this->owner, $player, $streak));
     $this->owner->getServer()->broadcastMessage(TextFormat::YELLOW . mc::_("%1% has a %2%-kill streak", $player->getDisplayName(), $streak));
     if ($this->money === null) {
         return true;
     }
     list($points, $money) = $this->owner->getPrizes("streak");
     $this->owner->getServer()->getPluginManager()->callEvent($ev = new KillRateBonusScoreEvent($this->owner, $player, $money));
     if ($ev->isCancelled()) {
         return true;
     }
     $player->sendMessage(TextFormat::GREEN . mc::_("You earn an additional \$%1% for being in kill-streak!", $ev->getMoney()));
     MoneyAPI::grantMoney($this->money, $player, $ev->getMoney());
     return true;
 }
开发者ID:kelvin7175,项目名称:pocketmine-plugins,代码行数:24,代码来源:KillStreak.php

示例8: getDisplayName

 public function getDisplayName()
 {
     return $this->player->getDisplayName();
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:4,代码来源:PlayerSubscriber.php

示例9: stdPlayerVars

 /**
  * Basic player specific variable definitions
  * @param Player $player - reference to pocketmine Player
  * @param array &$vars - receives variable defintions
  */
 public function stdPlayerVars(Player $player, array &$vars)
 {
     foreach (["{player}" => $player->getName(), "{displayName}" => $player->getDisplayName(), "{world}" => $player->getLevel()->getName(), "{x}" => (int) $player->getX(), "{y}" => (int) $player->getY(), "{z}" => (int) $player->getZ(), "{yaw}" => (int) $player->getYaw(), "{pitch}" => (int) $player->getPitch(), "{bearing}" => self::bearing($player->getYaw())] as $a => $b) {
         $vars[$a] = $b;
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:11,代码来源:ExpandVars.php

示例10: getFixedMessage

 /**
  * @param Player $player
  * @param string $message
  * @return string
  */
 public function getFixedMessage(Player $player, $message = "")
 {
     return str_replace(["{PLAYER_ADDRESS}", "{PLAYER_DISPLAY_NAME}", "{PLAYER_NAME}", "{PLAYER_PORT}"], [$player->getAddress(), $player->getDisplayName(), $player->getName(), $player->getPort()], $message);
 }
开发者ID:pomee4,项目名称:PocketMine-Plugins,代码行数:9,代码来源:PlanB.php

示例11: finalizePlayer

 public function finalizePlayer(Player $player, $isQuit)
 {
     if (isset($this->stack[$id = $player->getID()])) {
         unset($this->stack[$id]);
         // avoid bugs if the entity ID gets reused
         if ($isQuit) {
             $this->getLogger()->alert($player->getDisplayName() . " has quit, so his recording macro has been discarded.");
         } else {
             $this->getLogger()->alert("Discarding recording macro of " . $player->getDisplayName() . " due to plugin disable.");
             $player->sendMessage("Your recording macro has been discarded due to SimpleMacros being disabled.");
         }
     }
     if (isset($this->paused[$id])) {
         unset($this->stack[$id]);
     }
     if (isset($this->atts[$id])) {
         unset($this->atts[$id]);
     }
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:19,代码来源:Main.php

示例12: cmdAccept

 public function cmdAccept(Player $a, Player $b)
 {
     $k = implode(":", [strtolower($b->getName()), strtolower($a->getName())]);
     if (!isset($this->requests[$k])) {
         $a->sendMessage(mc::_("No teleport request from %1%", $b->getDisplayName()));
         return true;
     }
     $type = $this->requests[$k];
     unset($this->requests[$k]);
     switch ($type) {
         case "tpa":
             if (!MPMU::access($a, "gb.cmd.tpaccept.tpask")) {
                 return true;
             }
             $a->sendMessage(mc::_("Accepted teleport request from %1%", $b->getDisplayName()));
             $b->sendMessage(mc::_("%1% accepted your TPASK request", $a->getDisplayName()));
             $b->teleport($a);
             return true;
         case "tph":
             if (!MPMU::access($a, "gb.cmd.tpaccept.tpahere")) {
                 return true;
             }
             $a->sendMessage(mc::_("Accepted teleport request to %1%", $b->getDisplayName()));
             $b->sendMessage(mc::_("%1% accepted your TPAHERE request", $a->getDisplayName()));
             $a->teleport($b);
             return true;
     }
     $this->owner->getLogger()->error(mc::_("Invalid teleport request: %1%", $type));
     return false;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:30,代码来源:CmdTpRequest.php

示例13: getPlayerInformation

 /**
  * @param Player $player
  * @return array
  */
 public function getPlayerInformation(Player $player)
 {
     return ["name" => $player->getName(), "nick" => $player->getDisplayName(), "afk" => $this->isAFK($player), "location" => $this->getGeoLocation($player)];
 }
开发者ID:TBNRFrags2468,项目名称:EssentialsPE,代码行数:8,代码来源:BaseAPI.php

示例14: spawnPlayer

 public function spawnPlayer(Player $player, $lobby)
 {
     $message = TextFormat::GREEN . "[+]" . $player->getDisplayName();
     $player->getInventory()->clearAll();
     $player->getInventory()->setHotbarSlotIndex(0, 0);
     $this->games[$lobby]["players"][$player->getName()]["status"] = "waiting";
     $player->getServer()->broadcastMessage($message, $player->getLevel()->getPlayers());
     $player->setGamemode(2);
     $this->tpSpawn($player, $lobby, count(array_keys($this->games[$lobby]["players"])) - 1);
     return true;
 }
开发者ID:Edwardthedog2,项目名称:SpleefPE,代码行数:11,代码来源:Main.php

示例15: applyPCTags

 /**
  * @param $string
  * @param Player $player
  * @param $message
  * @param null $levelName
  * @return mixed
  */
 public function applyPCTags($string, Player $player, $message, $levelName)
 {
     // TODO
     $string = str_replace(array("{display_name}", "{DISPLAY_NAME}"), $player->getDisplayName(), $string);
     if ($message === null) {
         $message = "";
     }
     if ($player->hasPermission("pchat.coloredMessages")) {
         $string = str_replace(array("{msg}", "{MESSAGE}"), $this->applyColors($message), $string);
     } else {
         $string = str_replace(array("{msg}", "{MESSAGE}"), $this->stripColors($message), $string);
     }
     if ($this->factionsAPI !== null) {
         $string = str_replace(array("{fac_name}", "{FACTION_NAME}"), $this->factionsAPI->getPlayerFaction($player), $string);
         $string = str_replace(array("{fac_rank}", "{FACTION_RANK}"), $this->factionsAPI->getPlayerRank($player), $string);
     } else {
         $string = str_replace(array("{fac_name}", "{FACTION_NAME}"), '', $string);
         $string = str_replace(array("{fac_rank}", "{FACTION_RANK}"), '', $string);
     }
     $string = str_replace(array("{world}", "{WORLD}"), $levelName === null ? "" : $levelName, $string);
     $string = str_replace(array("{prefix}", "{PREFIX}"), $this->getPrefix($player, $levelName), $string);
     $string = str_replace(array("{suffix}", "{SUFFIX}"), $this->getSuffix($player, $levelName), $string);
     return $string;
 }
开发者ID:mad-hon,项目名称:PureChat,代码行数:31,代码来源:PureChat.php


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