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


PHP TextContainer::getParameters方法代码示例

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


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

示例1: translate

 public function translate(TextContainer $c)
 {
     if ($c instanceof TranslationContainer) {
         $baseText = $this->internalGet($c->getText());
         $baseText = $this->parseTranslation($baseText !== null ? $baseText : $c->getText());
         foreach ($c->getParameters() as $i => $p) {
             $baseText = str_replace("{%{$i}}", $this->parseTranslation($p), $baseText);
         }
     } else {
         $baseText = $this->parseTranslation($c->getText());
     }
     return $baseText;
 }
开发者ID:orlando092,项目名称:ImagicalMine,代码行数:13,代码来源:BaseLang.php

示例2: sendMessage

 /**
  * Sends a direct chat message to a player
  *
  * @param string|TextContainer $message
  */
 public function sendMessage($message)
 {
     if ($message instanceof TextContainer) {
         if ($message instanceof TranslationContainer) {
             $this->sendTranslation($message->getText(), $message->getParameters());
             return;
         }
         $message = $message->getText();
     }
     $mes = explode("\n", $this->server->getLanguage()->translateString($message));
     foreach ($mes as $m) {
         if ($m !== "") {
             $pk = new TextPacket();
             $pk->type = TextPacket::TYPE_RAW;
             $pk->message = $m;
             $this->dataPacket($pk);
         }
     }
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:24,代码来源:Player.php

示例3: sendMessage

 /**
  * Sends a direct chat message to a player
  *
  * @param string|TextContainer $message
  * @return bool
  */
 public function sendMessage($message)
 {
     if ($message instanceof TextContainer) {
         if ($message instanceof TranslationContainer) {
             $this->sendTranslation($message->getText(), $message->getParameters());
             return false;
         }
         $message = $message->getText();
     }
     $mes = explode("\n", $this->server->getLanguage()->translateString($message));
     foreach ($mes as $m) {
         if ($m !== "") {
             $this->server->getPluginManager()->callEvent($ev = new PlayerTextPreSendEvent($this, $m, PlayerTextPreSendEvent::MESSAGE));
             if (!$ev->isCancelled()) {
                 $pk = new TextPacket();
                 $pk->type = TextPacket::TYPE_RAW;
                 $pk->message = $ev->getMessage();
                 $this->dataPacket($pk);
             }
         }
     }
     return true;
 }
开发者ID:PepbookPvP,项目名称:Genisys,代码行数:29,代码来源:Player.php


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