本文整理匯總了PHP中pocketmine\command\CommandSender::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandSender::getId方法的具體用法?PHP CommandSender::getId怎麽用?PHP CommandSender::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pocketmine\command\CommandSender
的用法示例。
在下文中一共展示了CommandSender::getId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: marryCommand
function marryCommand(CommandSender $sender, array $args)
{
if (count($args) !== 1) {
$sender->sendMessage($this->getMessage("l.marry.usage"));
return true;
}
if ($this->provider->isMarried($sender->getName())) {
$sender->sendMessage($this->getMessage("l.married"));
return true;
}
if ($this->provider->isMarried($args[0])) {
$sender->sendMessage($this->getMessage("l.is-married", $args[0]));
return true;
}
if (strtolower($sender->getName()) == strtolower($args[0])) {
$sender->sendMessage($this->getMessage("no-marry-you"));
return true;
}
$this->updateQueries();
if (isset($this->queries[strtolower($sender->getName())])) {
$sender->sendMessage($this->getMessage("l.queried", $this->queries[strtolower($sender->getName())]->to));
return true;
}
if (!($to = $this->getServer()->getPlayer($args[0]))) {
$sender->sendMessage($this->getMessage("l.offline"));
return true;
}
$query = new Query();
$query->time = time();
$query->from = $sender->getName();
$query->to = $to->getName();
$this->queries[strtolower($sender->getName())] = $query;
foreach ($this->getServer()->getLevels() as $Level) {
foreach ($Level->getPlayers() as $Player) {
if ($Player->getId() != $sender->getId() && $Player->getId() != $to->getId()) {
$Player->sendMessage($this->getMessage("l.query-all", $sender->getName(), $to->getName()));
}
}
}
$sender->sendMessage($this->getMessage("l.you-query", $to->getName()));
$to->sendMessage($this->getMessage("l.query", $sender->getName()));
$to->sendMessage($this->getMessage("l.query-yes", $sender->getName()));
$to->sendMessage($this->getMessage("l.query-no"));
return true;
}