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


PHP PlayerItemConsumeEvent::getPlayer方法代码示例

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


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

示例1: playerItemConsume

 public function playerItemConsume(PlayerItemConsumeEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->getGamemode() == 0) {
         $item = $event->getItem();
         $item_consumed = $item->getID();
         if ($this->isExistsItem($item_consumed)) {
             $event->setCancelled();
             $count = $item->getCount();
             if ($count == 1) {
                 $item = Item::get(0, 0, 0);
             } else {
                 $item->setCount($count - 1);
             }
             $player->getInventory()->setItemInHand($item);
             if ($item_consumed == 367 || $item_consumed == 365) {
                 if ($this->setPlayerPoisoned($player->getDisplayName(), $this->poison[$item_consumed]) == true) {
                     $this->chat($player, "You have been poisoned by food", 4);
                 }
             }
             $var = $this->items[$item_consumed];
             $this->addFoodLevel($player, $var[0]);
             $this->addFoodSaturationLevel($player, $var[1]);
             $this->test($player->getDisplayName());
         }
     }
 }
开发者ID:TDMGamingMC,项目名称:HungerSimulator,代码行数:27,代码来源:EventPlayer.php

示例2: eat

 public function eat(PlayerItemConsumeEvent $ev)
 {
     $p = $ev->getPlayer();
     if ($ev->getItem()->getId() === 322) {
         $p->addEffect(Effect::getEffect(10)->setAmplifier(4)->setDuration(100)->setVisible(true));
         $p->addEffect(Effect::getEffect(21)->setAmplifier(2)->setDuration(20 * 120)->setVisible(true));
     }
 }
开发者ID:ItzFrozenCreeper,项目名称:Golden-Apple,代码行数:8,代码来源:Main.php

示例3: onEat

 public function onEat(Eat $e)
 {
     $p = $e->getPlayer();
     //How to get a player. Simple if you want to do things when the function is used.
     $item = $e->getItem();
     $id = $item->getId();
     if ($id == 364) {
         $p->sendMessage("Ayyy me amigooo! You just ate a tacoooo!");
         //Sends the player a message when they eat the "taco" (Its actually steak)
     }
 }
开发者ID:XFuryMCPE,项目名称:PocketMineTacos,代码行数:11,代码来源:PocketMineTacos.php

示例4: onItemConsume

 public function onItemConsume(PlayerItemConsumeEvent $event)
 {
     if ($this->plugin->getConfig()->getAll()["block-all-events"]) {
         if (!ServerAuth::getAPI()->isPlayerRegistered($event->getPlayer()->getName()) || !ServerAuth::getAPI()->isPlayerAuthenticated($event->getPlayer())) {
             $event->setCancelled(true);
         }
     }
 }
开发者ID:RedstoneAlmeida,项目名称:SliceAuth,代码行数:8,代码来源:EventListener.php

示例5: onPlayerItemConsume

 /**
  * @param PlayerItemConsumeEvent $event
  *
  * @priority LOWEST
  */
 public function onPlayerItemConsume(PlayerItemConsumeEvent $event)
 {
     if (!$this->auth->isPlayerAuthenticated($event->getPlayer())) {
         $event->setCancelled(true);
     }
 }
开发者ID:jigibbs123,项目名称:pocketmine-plugins,代码行数:11,代码来源:EventListener.php

示例6: onPlayerEat

 public function onPlayerEat(pic $ev)
 {
     $p = $ev->getPlayer();
     $i = $ev->getItem();
     switch ($this->phase) {
         case 0:
             //Waiting in the lobby
         //Waiting in the lobby
         case 1:
             //Starting the game
             $ev->setCancelled();
             break;
         case 2:
         case 3:
             if ($i->getId() == Item::GOLDEN_APPLE) {
                 $p->addEffect(Effect::getEffect(6)->setAmplifier(1)->setDuration(4));
             }
             break;
     }
 }
开发者ID:nao20010128nao,项目名称:UltraHardCore,代码行数:20,代码来源:UHC.php

示例7: onConsume

 public function onConsume(PlayerItemConsumeEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $pl = $ev->getPlayer();
     if ($pl->hasPermission("wp.banitem.exempt")) {
         return;
     }
     $world = $pl->getLevel()->getName();
     if (!isset($this->wcfg[$world])) {
         return;
     }
     $item = $ev->getItem();
     if (!isset($this->wcfg[$world][$item->getId()])) {
         return;
     }
     $pl->sendMessage(mc::_("You can not use that item here!"));
     $ev->setCancelled();
 }
开发者ID:HeechFive,项目名称:pocketmine-plugins,代码行数:20,代码来源:BanItem.php

示例8: onPlayerItemConsume

 public function onPlayerItemConsume(PlayerItemConsumeEvent $event)
 {
     if ($event->getItem()->getId() === Item::MUSHROOM_STEW) {
         $playerGameId = $this->players[$event->getPlayer()->getName()];
         if ($playerGameId === "NONE") {
             return true;
         }
         $this->games[$playerGameId]->useMedicine($event->getPlayer()->getName());
         $event->getPlayer()->sendMessage(TextFormat::GREEN . $this->getTranslation("MEDICINE_USED"));
     }
     return true;
 }
开发者ID:EpicArtz08999,项目名称:ZombieGame,代码行数:12,代码来源:GameGenius.php

示例9: onConsume

 public function onConsume(PlayerItemConsumeEvent $ev)
 {
     $this->checkPlenty($ev->getPlayer(), $ev->getItem());
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:4,代码来源:CmdPlenty.php

示例10: onFoodEat

 public function onFoodEat(PlayerItemConsumeEvent $event)
 {
     if ($this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] !== true) {
         $event->setCancelled(true);
     } elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
         $event->setCancelled(true);
         $event->getPlayer()->sendMessage($this->disable);
     }
 }
开发者ID:EpicArtz08999,项目名称:xAuth,代码行数:9,代码来源:LoginTasks.php

示例11: onEat

 public function onEat(PlayerItemConsumeEvent $event)
 {
     $user = $this->main->getUserByPlayer($event->getPlayer());
     if ($user === null or !$user->isPlaying()) {
         $event->setCancelled();
     }
 }
开发者ID:GoneTone,项目名称:HereAuth,代码行数:7,代码来源:EventRouter.php

示例12: onPlayerItemConsume

 public function onPlayerItemConsume(\pocketmine\event\player\PlayerItemConsumeEvent $event)
 {
     if (!$this->isLogin($event->getPlayer())) {
         $event->setCancelled();
     }
 }
开发者ID:JungHyun3459,项目名称:PocketMine-Plugins,代码行数:6,代码来源:Login.php

示例13: onPlayerItemConsume

 public function onPlayerItemConsume(PlayerItemConsumeEvent $event)
 {
     $event->setCancelled($this->isLogin($event->getPlayer()) ? false : true);
 }
开发者ID:stoastye85,项目名称:Plugins,代码行数:4,代码来源:Login.php

示例14: onPlayerItemConsume

 public function onPlayerItemConsume(PlayerItemConsumeEvent $event)
 {
     if (!$this->isValidPlayer($event->getPlayer())) {
         return;
     }
     if ($this->players[$event->getPlayer()->getName()]->getSkillByItem($event->getItem()) !== null) {
         $event->setCancelled();
     }
 }
开发者ID:HelloWorld017,项目名称:ToAruPG,代码行数:9,代码来源:ToAruPG.php

示例15: onPlayerItemConsume

 public function onPlayerItemConsume(PlayerItemConsumeEvent $event)
 {
     if (isset($this->needAuth[$event->getPlayer()->getName()])) {
         $event->setCancelled();
         $this->deauthenticatePlayer($event->getPlayer());
     }
 }
开发者ID:HerO-0110,项目名称:EmailAuth,代码行数:7,代码来源:EmailAuth.php


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