当前位置: 首页>>代码示例>>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;未经允许,请勿转载。