當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommandSender::getId方法代碼示例

本文整理匯總了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;
 }
開發者ID:GracieWargo,項目名稱:PocketMine,代碼行數:45,代碼來源:Love.php


注:本文中的pocketmine\command\CommandSender::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。