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


PHP BlockPlaceEvent::getBlock方法代码示例

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


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

示例1: blockPlace

 public function blockPlace(BlockPlaceEvent $event)
 {
     //2
     $id = $event->getItem()->getId();
     if ($id == $this->id) {
         $player = $event->getPlayer();
         $username = $player->getName();
         if (empty($this->data[$user][2])) {
             $x = $event->getBlock()->x;
             $y = $event->getBlock()->y;
             $z = $event->getBlock()->z;
             $this->data[$user][2] = array($x, $y, $z);
             $ms = "";
             if (isset($this->data[$user][2])) {
                 //片方がセットされていたら
                 $ms = "[FiredNubesco] Second position has been set to: {$x}, {$y}, {$z}";
                 $size = $this->countBlocks($player);
                 if ($num != false) {
                     $ms .= " (Size: " . $size[0] . "X" . $size[1] . ")";
                 }
             } else {
                 $ms = "[FiredNubesco] First position has been set to: {$x}, {$y}, {$z}";
             }
             $player->sendMessage($ms);
             $event->setCancelled(true);
         }
     }
     return true;
 }
开发者ID:nao20010128nao,项目名称:FiredNubesco,代码行数:29,代码来源:PluginMain.php

示例2: onPlace

 public function onPlace(BlockPlaceEvent $event)
 {
     if ($event->getBlock()->getId() != Block::CHEST) {
         return;
     }
     $block = $event->getBlock();
     if ($this->sideCheck($block->x + 1, $block->y, $block->z, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST or $this->sideCheck($block->x - 1, $block->y, $block->z, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST or $this->sideCheck($block->x, $block->y, $block->z + 1, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST or $this->sideCheck($block->x, $block->y, $block->z - 1, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST) {
         $event->getPlayer()->sendMessage(TextFormat::RED . "바로 옆에 다른사람의 상자가 있습니다, 설치 불가능 !");
         return;
     }
     $this->configData["{$block->x}:{$block->y}:{$block->z}"] = $event->getPlayer()->getName();
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:12,代码来源:ChestGuard.php

示例3: onBlockPlace

 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $block = $event->getBlock()->getName();
     if ($block == "Chest") {
         $this->arenaManager->onChestPlaced($event);
     }
 }
开发者ID:TuffDev,项目名称:HungerGames,代码行数:7,代码来源:EventManager.php

示例4: PlaceQueeue

 public function PlaceQueeue(BlockPlaceEvent $event)
 {
     $block = $event->getBlock();
     if ($block->getID() === Item::BED_BLOCK) {
         $player = $event->getPlayer();
         $this->placeQueeue[$player->getName()] = 1;
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:8,代码来源:GoodMorning.php

示例5: onBlockPlace

 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     if ($player->hasPermission('log.placed.block')) {
         $this->plugin->addPlacedBlock($block, $player);
         // ADD TIME
     }
 }
开发者ID:Artide,项目名称:SupremePlugins,代码行数:9,代码来源:EventListener.php

示例6: onBlockPlace

 /**
  * @param BlockPlaceEvent $event
  *
  * @priority HIGH
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     // PowerTool
     if ($this->getAPI()->executePowerTool($event->getPlayer(), $event->getItem())) {
         $event->setCancelled(true);
     } elseif ($this->getAPI()->isUnlimitedEnabled($event->getPlayer())) {
         $event->setCancelled(true);
         $pos = new Vector3($event->getBlockReplaced()->getX(), $event->getBlockReplaced()->getY(), $event->getBlockReplaced()->getZ());
         $event->getPlayer()->getLevel()->setBlock($pos, $event->getBlock(), true);
     }
 }
开发者ID:TBNRFrags2468,项目名称:EssentialsPE,代码行数:16,代码来源:OtherEvents.php

示例7: onBanblock

 public function onBanblock(BlockPlaceEvent $event)
 {
     $blocklist = array("46", "327", "10", "11");
     foreach ($blocklist as $Bancode) {
         if ($event->getBlock()->getId() == $Bancode) {
             $event->setCancelled(true);
             $player = $event->getPlayer();
             $player->sendMessage(TextFormat::RED . $player->getName() . "님이 금지된 아이템을 사용하였습니다");
         }
     }
 }
开发者ID:sJimin,项目名称:PHPTEST,代码行数:11,代码来源:FirstBase.php

示例8: onPlace

 public function onPlace(BlockPlaceEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("customareas.bypass")) {
         foreach ($this->plugin->areas as $area) {
             if ($area->isInside($event->getBlock()) and !$area->canBuild($event->getPlayer())) {
                 $event->setCancelled();
                 $event->getPlayer()->sendMessage("This is " . $area->owner . "'s private area");
             }
         }
     }
 }
开发者ID:robske110,项目名称:CustomAreas,代码行数:11,代码来源:EventListener.php

示例9: onBlockPlace

 /**
  * @priority HIGHEST
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     if (!$event->isCancelled()) {
         $block = $event->getBlock();
         if (isset($this->levelTickBlocks[$levelName = $block->getLevel()->getFolderName()]) && isset($this->randomTickBlocks[$levelName])) {
             if (in_array($block->getID(), $this->randomTickBlocks[$levelName]) && $block->getID() !== Block::GLASS && !isset($this->levelTickBlocks[$levelName][$posKey = $block->x . ":" . $block->y . ":" . $block->z])) {
                 $this->levelTickBlocks[$levelName][$posKey] = new Position($block->x, $block->y, $block->z, $block->level);
             }
         }
     }
 }
开发者ID:organization,项目名称:AutoGrow,代码行数:14,代码来源:AutoGrow.php

示例10: onPlace

 public function onPlace(BlockPlaceEvent $bpe)
 {
     $pl = $bpe->getPlayer();
     $name = $pl->getName();
     $bl = $bpe->getBlock();
     $blname = $bl->getName();
     $lvl = $pl->getLevel()->getName();
     $x = $pl->getX();
     $y = $pl->getY();
     $z = $pl->getZ();
     $this->getLogger()->info(C::YELLOW . "{$name}" . C::DARK_AQUA . " Placed/tried to Place (a)" . C::YELLOW . " {$blname}" . C::DARK_AQUA . " in World:" . C::YELLOW . " {$lvl}" . C::DARK_AQUA . " at Position:" . C::YELLOW . " {$x}, {$y}, {$z}");
 }
开发者ID:StarCoders,项目名称:BIT,代码行数:12,代码来源:Main.php

示例11: place

 public function place(BlockPlaceEvent $place)
 {
     $block = $place->getBlock();
     $player = $place->getPlayer();
     if ($block->getId() === 46) {
         $place->setCancelled();
         $mot = (new Random())->nextSignedFloat() * M_PI * 2;
         $tnt = Entity::createEntity("PrimedTNT", $block->getLevel()->getChunk($block->x >> 4, $block->z >> 4), new Compound("", ["Pos" => new EnumTag("Pos", [new DoubleTag("", $block->x + 0.5), new DoubleTag("", $block->y), new DoubleTag("", $block->z + 0.5)]), "Motion" => new EnumTag("Motion", [new DoubleTag("", -sin($mot) * 0.02), new DoubleTag("", 0.2), new DoubleTag("", -cos($mot) * 0.02)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)]), "Fuse" => new ByteTag("Fuse", 100)]));
         $tnt->spawnToAll();
         $player->getLevel()->addSound(new AnviluseSound($player), array($player));
         return true;
     }
 }
开发者ID:NawafCraft,项目名称:TNT1B,代码行数:13,代码来源:Tnt.php

示例12: onBlockPlace

 public function onBlockPlace(BlockPlaceEvent $event)
 {
     if ($this->plugin->cfg->get("debugmode") == "true") {
         $this->plugin->getServer()->getLogger()->info(MT::GREEN . "CommandTest BPosition Place");
     }
     $id = $event->getPlayer()->getID();
     if (in_array($id, $this->schalter)) {
         $bl = $event->getBlock();
         $n = strtolower($event->getPlayer()->getName());
         $this->pos[$n] = new Vector3($bl->getX(), $bl->getY(), $bl->getZ());
         $event->getPlayer()->sendMessage(MT::GOLD . "Position(" . $this->pos[$n]->getX() . "," . $this->pos[$n]->getY() . "," . $this->pos[$n]->getZ() . ")");
         $event->setCancelled(true);
     }
 }
开发者ID:LittleBigMC,项目名称:Minecraft-Pocket-Edition,代码行数:14,代码来源:bposition.php

示例13: playerBlockPlace

 public function playerBlockPlace(BlockPlaceEvent $event)
 {
     $id = $event->getBlock()->getID();
     $player = $event->getPlayer();
     if ($id == in_array($id, $this->config->get("banned-items"))) {
         if ($player->isOp()) {
             if (!$this->config->get("ops-can-use-items") == true) {
                 $player->sendMessage($this->config->get("msg-item-use"));
                 $event->setCancelled();
             }
         } else {
             $player->sendMessage($this->config->get("msg-item-use"));
             $event->setCancelled();
         }
     }
 }
开发者ID:tnpxxsheepdog,项目名称:AntiBuild,代码行数:16,代码来源:AntiBuild.php

示例14: onBlockPlace

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

示例15: blockPlace

 public function blockPlace(BlockPlaceEvent $event)
 {
     $block = $event->getBlock();
     if ($block->getId() == 52) {
         $block->setDamage(32);
         $event->setCancelled();
         $block->getLevel()->setBlock($block, $block);
     }
 }
开发者ID:edwinyoo44,项目名称:MyOwnWorld,代码行数:9,代码来源:MyOwnWorld.php


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