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


PHP CommandSender::setFood方法代码示例

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


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

示例1: execute

 public function execute(cmd\CommandSender $sender, $label, array $args)
 {
     if ($sender instanceof Player) {
         if (count($args) != 0) {
             if ($sender->hasPermission("feedme.other")) {
                 $name = $args[0];
                 $player = $this->plugin->getServer()->getPlayer($name);
                 if ($player instanceof Player) {
                     // Send some pointless messeges
                     $sender->sendMessage(TextFormat::BLUE . "Yo mama fed " . $name . " face!");
                     $player->sendMessage(TextFormat::BLUE . $sender->getName() . " mama fed ur face!");
                     // set food to 20
                     $player->setFood(20);
                     return true;
                 } else {
                     $sender->sendMessage(TextFormat::BLUE . "Player ain't online!");
                     return true;
                 }
             } else {
                 $sender->sendMessage(TextFormat::DARK_RED . "Ain't nobody got that permissions!");
                 return true;
             }
         } else {
             // If args is missing set your own food to 20
             $sender->sendMessage(TextFormat::BLUE . "Yo mama fed ur face!");
             $sender->setFood(20);
             return true;
         }
     } else {
         $sender->sendMessage(TextFormat::DARK_RED . "Nah not gonna feed that console");
         return true;
     }
 }
开发者ID:TomasOlsson,项目名称:YoMomaFeed,代码行数:33,代码来源:feed.php

示例2: execute

 public function execute(cmd\CommandSender $sender, $label, array $args)
 {
     if ($sender instanceof Player) {
         if (count($args) != 0) {
             if ($sender->hasPermission("feedme.other")) {
                 $name = $args[0];
                 $player = $this->plugin->getServer()->getPlayer($name);
                 if ($player instanceof Player) {
                     // Send some pointless messeges
                     $sender->sendMessage(TextFormat::BLUE . "Der Spieler " . $name . " wurde gefuettert!");
                     $player->sendMessage(TextFormat::BLUE . $sender->getName() . " hat dich gefuettert!");
                     // set food to 20
                     $player->setFood(20);
                     return true;
                 } else {
                     $sender->sendMessage(TextFormat::BLUE . "Spieler ist nicht online!");
                     return true;
                 }
             } else {
                 $sender->sendMessage(TextFormat::DARK_RED . "Du hast nicht die Berechtigung zum fuettern!");
                 return true;
             }
         } else {
             // If args is missing set your own food to 20
             $sender->sendMessage(TextFormat::BLUE . "Du wurdest gefuettert!");
             $sender->setFood(20);
             return true;
         }
     } else {
         $sender->sendMessage(TextFormat::DARK_RED . "Du kannst die Konsole nicht füttern!");
         return true;
     }
 }
开发者ID:HimbeersaftLP,项目名称:AntiHunger-YoMomaFeed-in-German,代码行数:33,代码来源:feed.php


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