本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}