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


PHP BlockBreakEvent::setDrops方法代码示例

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


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

示例1: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     if ($event->getBlock()->getId() == 15) {
         $drops = array(Item::get(265, 0, 1));
         $event->setDrops($drops);
     }
     if ($event->getBlock()->getId() == 14) {
         $drops = array(Item::get(266, 0, 1));
         $event->setDrops($drops);
     }
 }
开发者ID:LilianRise,项目名称:OreInstantDrop,代码行数:11,代码来源:Main.php

示例2: onBreak

 public function onBreak(BlockBreakEvent $ev)
 {
     $p = $ev->getPlayer();
     $block = $ev->getBlock();
     $item = $ev->getItem()->getId();
     $ev->setInstaBreak(true);
     foreach ($this->ores as $ore) {
         if ($block->getId() === $ore && !$ev->isCancelled()) {
             $ev->setDrops(array());
             $p->sendMessage("§l§dAUTO-SMELTED!");
             $p->getInventory()->addItem(Item::get($this->ingot[$ore]));
             $x = $p->getX();
             $y = $p->getY();
             $z = $p->getZ();
             $p->getLevel()->addSound(new FizzSound(new Vector3($x, $y, $z)));
         }
     }
 }
开发者ID:Ad5001,项目名称:AutoSmelt,代码行数:18,代码来源:Main.php

示例3: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getName();
     $block = $event->getBlock();
     $block2 = $player->getLevel()->getBlock(new Vector3($block->getX(), $block->getY() - 1, $block->getZ()), false);
     if ($this->inArena($player)) {
         $arena = $this->getArena($player);
         $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
         $team = $this->getTeamByBed($arena, $block);
         if ($config->get("Status") != "Lobby") {
             if ($block->getId() == Block::BED_BLOCK) {
                 if ($team != $this->getTeam($player->getNameTag())) {
                     $config->setNested("Bed." . $team . ".Alive", false);
                     $config->save();
                     $event->setDrops(array());
                     $player->sendMessage($this->prefix . "Du hast das Bett von Team " . $team . " zerstört!");
                     foreach ($this->getPlayers($arena) as $pn) {
                         $p = $this->getServer()->getPlayerExact($pn);
                         if ($p != null) {
                             if ($team == $this->getTeam($p->getNameTag())) {
                                 $p->sendMessage($this->prefix . TextFormat::RED . "Das Bett von deinem Team wurde zerstört!");
                             } else {
                                 $p->sendMessage($this->prefix . "Das Bett von Team " . TextFormat::GOLD . $team . TextFormat::WHITE . " wurde zerstört!");
                             }
                         }
                     }
                 } else {
                     $player->sendMessage($this->prefix . "Du kannst dein eigenes Bett nicht zerstören!");
                     $event->setCancelled();
                 }
             } elseif (!in_array($block->getId(), $this->breakableblocks)) {
                 $event->setCancelled();
             }
         } else {
             $event->setCancelled();
         }
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:39,代码来源:Bedwars.php


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