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


PHP InventoryPickupItemEvent::setCancelled方法代码示例

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


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

示例1: onPickUp

 public function onPickUp(InventoryPickupItemEvent $event)
 {
     if ($event->getPlayer() instanceof Player && $this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] !== true && $this->plugin->allowPickup !== 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

示例2: onPickupItem

 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if (!$this->isLogin($player)) {
         $event->setCancelled();
         return true;
     }
 }
开发者ID:pid011,项目名称:SimpleLogin,代码行数:8,代码来源:EventListener.php

示例3: onPickup

 public function onPickup(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player) {
         if ($event->getItem()->getItem()->getId() === self::GUN_ID) {
             $this->players[$player->getName()][0]->addAmmo(30);
             if ($player->getInventory()->contains(Item::get(self::GUN_ID))) {
                 $event->getItem()->kill();
                 $event->setCancelled();
             }
         } else {
             $event->getItem()->kill();
         }
     }
 }
开发者ID:EmreTr1,项目名称:MineCombat,代码行数:15,代码来源:MineCombat.php

示例4: onPickupItem

 /**
  * @param InventoryPickupItemEvent $event
  *
  * @priority LOWEST
  */
 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player and !$this->auth->isPlayerAuthenticated($player)) {
         $event->setCancelled(true);
     }
 }
开发者ID:jigibbs123,项目名称:pocketmine-plugins,代码行数:12,代码来源:EventListener.php

示例5: onPickupItem

 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $holder = $event->getInventory()->getHolder();
     if (!$holder instanceof Player) {
         return;
     }
     $session = $this->main->getSession($holder);
     if (!$session instanceof Session) {
         $event->setCancelled();
         return;
     }
     if ($session->onPickupItem($event) === false) {
         $event->setCancelled();
     }
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:15,代码来源:SessionEventListener.php

示例6: h_onPickup

 public function h_onPickup(InventoryPickupItemEvent $event)
 {
     if (!$this->isLoggedIn()) {
         $event->setCancelled();
     }
 }
开发者ID:LegionPE,项目名称:LegionPE-Eta,代码行数:6,代码来源:Session.php

示例7: onPickupItem

 /**
  * @param InventoryPickupItemEvent $event
  *
  * @priority HIGH
  * @ignoreCancelled true
  */
 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player and !$player->isOp()) {
         foreach ($this->plugin->getAllZones() as $zone) {
             if ($zone->isIn($event->getItem())) {
                 if ($player->hasPermission($zone->getName() . MEMBER)) {
                     break;
                 }
                 $event->setCancelled(true);
                 $player->sendMessage("[iZone] This is a private area.");
                 break;
             }
         }
     }
 }
开发者ID:Tee7even,项目名称:iZone,代码行数:22,代码来源:EventManager.php

示例8: onPickup

 public function onPickup(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player) {
         if ($this->inArena($player)) {
             if (!in_array($event->getItem()->getId(), $this->pickup)) {
                 if ($event->getItem()->getItem()->getId() == Item::BRICK) {
                     $event->setCancelled();
                     $player->getLevel()->removeEntity($event->getItem());
                     $this->pickup[] = $event->getItem()->getId();
                     $player->setExpLevel($player->getExpLevel() + 1);
                     $player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "1 Level!");
                 }
                 if ($event->getItem()->getItem()->getId() == Item::IRON_INGOT) {
                     $event->setCancelled();
                     $player->getLevel()->removeEntity($event->getItem());
                     $this->pickup[] = $event->getItem()->getId();
                     $player->setExpLevel($player->getExpLevel() + 10);
                     $player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "10 Level!");
                 }
                 if ($event->getItem()->getItem()->getId() == Item::GOLD_INGOT) {
                     $event->setCancelled();
                     $player->getLevel()->removeEntity($event->getItem());
                     $this->pickup[] = $event->getItem()->getId();
                     $player->setExpLevel($player->getExpLevel() + 20);
                     $player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "20 Level!");
                 }
             }
         }
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:31,代码来源:Bedwars.php

示例9: onPick

 public function onPick(InventoryPickupItemEvent $event)
 {
     $inv = $event->getInventory();
     if (!$inv instanceof PlayerInventory) {
         return;
     }
     $player = $inv->getHolder();
     if (!$player instanceof Player) {
         return;
     }
     $user = $this->main->getUserByPlayer($player);
     if ($user === null or !$user->isPlaying()) {
         $event->setCancelled();
     }
 }
开发者ID:GoneTone,项目名称:HereAuth,代码行数:15,代码来源:EventRouter.php

示例10: onPickup

 public function onPickup(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player) {
         $item = $event->getItem()->getItem();
         if (isset($this->loadedGuns[$item->getId() . ":" . $item->getDamage()])) {
             $gun = $this->players[$player->getName()][0];
             if ($gun->getGunItem() === $item->getId() . ":" . $item->getDamage()) {
                 $gun->addAmmo($gun->getMagazineAmmo());
                 $event->getItem()->kill();
             }
             $event->setCancelled();
         } else {
             $event->getItem()->kill();
         }
     }
 }
开发者ID:EmeraldGem585,项目名称:MineCombat,代码行数:17,代码来源:MineCombat.php

示例11: onPickup

 public function onPickup(InventoryPickupItemEvent $event)
 {
     $inv = $event->getInventory();
     if (!$inv instanceof PlayerInventory) {
         return;
     }
     $player = $inv->getHolder();
     if (!$player instanceof Player) {
         return;
     }
     $session = $this->getMain()->getSessions()->getSession($player);
     if (!$session->inSession($this)) {
         return;
     }
     $item = $event->getItem();
     if ($item instanceof ItemBlock) {
         if ($item->getBlock() === Block::SNOW_BLOCK) {
             $event->setCancelled();
         }
     }
 }
开发者ID:LegionPE,项目名称:LegionPE-Eta,代码行数:21,代码来源:SpleefGame.php


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