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


PHP BlockBreakEvent::setCancelled方法代码示例

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


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

示例1: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     if ($event->getBlock()->getId() != Block::CHEST) {
         return;
     }
     $block = $event->getBlock();
     if (!isset($this->configData["{$block->x}:{$block->y}:{$block->z}"])) {
         return;
     }
     if ($this->configData["{$block->x}:{$block->y}:{$block->z}"] == $event->getPlayer()->getName()) {
         unset($this->configData["{$block->x}:{$block->y}:{$block->z}"]);
         $event->getPlayer()->sendMessage(TextFormat::DARK_AQUA . "상자 보호가 해제되었습니다 !");
         $event->setCancelled();
     } else {
         if ($event->getPlayer()->isOp()) {
             return;
         }
         if ($this->simpleArea != null) {
             $area = $this->simpleArea->db[$block->getLevel()->getFolderName()]->getArea($block->x, $block->z);
             if ($area != null) {
                 if (isset($area["resident"][0]) and $area["resident"][0] == $event->getPlayer()->getName()) {
                     return;
                 }
             }
         }
         $event->getPlayer()->sendMessage(TextFormat::RED . "이 상자는 " . $this->configData["{$block->x}:{$block->y}:{$block->z}"] . " 님의 소유입니다, 파괴 불가 !");
         $event->setCancelled();
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:29,代码来源:ChestGuard.php

示例2: onBlockBreak

 /**
  * @param BlockBreakEvent $event
  */
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     $b = $event->getBlock();
     if ($this->getPlugin()->pos_display_flag == 1) {
         $event->getPlayer()->sendMessage("BREAKED: [x=" . $b->x . " y=" . $b->y . " z=" . $b->z . "]");
     }
     // @fix1- team can only break enermy flag and not own
     $redTeamFlagPos = $this->getSetup()->getFlagPos(CTFSetup::CTF_FLAG_RED_TEAM);
     if (round($b->x) == round($redTeamFlagPos->x) && round($b->y) == round($redTeamFlagPos->y) && round($b->z) == round($redTeamFlagPos->y)) {
         if (isset($this->pgin->redTeamPlayers[$player->getName()])) {
             // update again to fix color issue
             $this->getBuilder()->addBlueTeamFlag($player->getLevel(), 171, 14);
             $event->setCancelled(true);
         }
     }
     $blueTeamFlagPos = $this->getSetup()->getFlagPos(CTFSetup::CTF_FLAG_BLUE_TEAM);
     if (round($b->x) == round($blueTeamFlagPos->x) && round($b->y) == round($blueTeamFlagPos->y) && round($b->z) == round($blueTeamFlagPos->z)) {
         if (isset($this->pgin->blueTeamPLayers[$player->getName()])) {
             // update again to fix color issue
             $this->getBuilder()->addBlueTeamFlag($player->getLevel(), 171, 11);
             $event->setCancelled(true);
         }
     }
     // @fix #2 stop player break anything else other than the flags
     if (strtolower($player->level->getName()) == strtolower($this->getSetup()->getCTFWorldName())) {
         if ($this->getSetup()->isCTFWorldBlockBreakDisable() || !$player->isOp()) {
             if ($b->getId() != 171) {
                 $event->setCancelled(true);
             }
         }
     }
 }
开发者ID:JiangsNetworkAlpha,项目名称:CaptureTheFlag,代码行数:36,代码来源:CTFListener.php

示例3: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     if ($event->getPlayer()->hasPermission("worldprotector.block.break")) {
         $event->setCancelled(false);
     } else {
         $event->setCancelled(true);
     }
 }
开发者ID:Pocket-GAD,项目名称:PocketMine-MP-Plugins,代码行数:8,代码来源:EventListener.php

示例4: blockBreak

 public function blockBreak(BlockBreakEvent $event)
 {
     //1
     $id = $event->getItem()->getId();
     if ($id == $this->id) {
         $player = $event->getPlayer();
         $username = $player->getName();
         if (empty($this->data[$user][1])) {
             $x = $event->getBlock()->x;
             $y = $event->getBlock()->y;
             $z = $event->getBlock()->z;
             $this->data[$user][1] = 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

示例5: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->isCreative()) {
         return;
     }
     $time = round(microtime(true) * 1000);
     if ($event->getBlock()->getBreakTime($event->getItem()) <= 0.2) {
         return;
     }
     if ($time - $this->tictock[$player->getName()] <= 200) {
         if (!isset($this->kick[$player->getName()])) {
             $this->kick[$player->getName()] = 1;
         } else {
             $this->kick[$player->getName()]++;
         }
         if ($this->kick > 2) {
             $player->kick("파괴자모드 감지");
             if (isset($this->kick[$player->getName()])) {
                 unset($this->kick[$player->getName()]);
             }
         }
         $event->setCancelled();
     } else {
         if (isset($this->kick[$player->getName()])) {
             unset($this->kick[$player->getName()]);
         }
     }
     $this->tictock[$player->getName()] = $time;
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:30,代码来源:TICTOCK.php

示例6: onBlockBreakEvent

 public function onBlockBreakEvent(BlockBreakEvent $event)
 {
     if (!$event->getPlayer()->isOp()) {
         $event->setCancelled(true);
         $this->debug->onDebug('BlockBreakEvent');
     }
 }
开发者ID:100henrik100,项目名称:Minecraft-Pocket-Edition,代码行数:7,代码来源:antibuild.php

示例7: onBlockBreak

 /** 
  * @param BlockBreakEvent $event
  * @priority HIGHEST
  * @ignoreCancelled true
  */
 public function onBlockBreak(BlockBreakEvent $event)
 {
     if (!$this->plugin->getStorage()->getShield($event->getPlayer()->getLevel())->isAllowed(Shield::BREAKING)) {
         $event->setCancelled(true);
         $event->getPlayer()->sendTip($this->plugin->getConfig()->get("breakNotAllowed"));
     }
 }
开发者ID:NameNoOne100,项目名称:PocketMine-Plugins,代码行数:12,代码来源:GlobalShieldListener.php

示例8: onBlockBreak

 public function onBlockBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     if (!$player->hasPermission("xperms.build")) {
         $player->sendMessage(TextFormat::RED . $this->plugin->getConfiguration()->getMSGonIBuildPerm());
         $event->setCancelled(true);
     }
 }
开发者ID:BoysElCrack,项目名称:xPermissions,代码行数:8,代码来源:xListener.php

示例9: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     if ($event->getBlock()->getId() === FlowerPotMain::BLOCK_ITEM_FRAME and !$player->isOp()) {
         $player->sendMessage("You do not have permission.");
         $event->setCancelled();
     }
 }
开发者ID:beito123,项目名称:PocketMine-MP-Plugins,代码行数:8,代码来源:ExamplePlugin.php

示例10: onBlockBreak

 public function onBlockBreak(BlockBreakEvent $event)
 {
     if ($this->plugin->isJailed($event->getPlayer())) {
         $event->getPlayer()->sendMessage("§eYou are not allowed to destroy the jail!\nAdded " . $this->getPlugin()->getConfig()->get("punish-additional-minutes") . " minutes as punishment.");
         $this->getPlugin()->punish($event->getPlayer(), $this->getPlugin()->getConfig()->get("punish-additional-minutes"));
         $event->setCancelled(true);
     }
 }
开发者ID:HerO-0110,项目名称:Jail,代码行数:8,代码来源:BlockListener.php

示例11: onBlockBreak

 public function onBlockBreak(BlockBreakEvent $event)
 {
     if ($event->isCancelled()) {
         return;
     }
     if ($this->chopTree($event->getPlayer(), $event->getBlock(), $event->getItem(), self::TYPE_BREAK)) {
         $event->setCancelled(true);
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:9,代码来源:ChopTree.php

示例12: playerBlockBreak

 public function playerBlockBreak(BlockBreakEvent $event)
 {
     $block = $event->getBlock();
     if ($block->getID() == Item::WALL_SIGN || $block->getID() == Item::SIGN_POST) {
         $player = $event->getPlayer();
         $signManager = $this->SignShop->getSignManager();
         if ($signManager->existsSign($block)) {
             $get = $signManager->getSign($block);
             if (strtolower($get["maker"]) == strtolower($player->getName())) {
                 if (is_numeric($get["available"]) && $get["need"] > -1) {
                     while ($get["available"] > 0) {
                         $item = new Item($get["id"], $get["damage"], $get["amount"]);
                         if ($player->getInventory()->canAddItem($item)) {
                             if ($get["available"] - $get["amount"] < 0) {
                                 break;
                             }
                             $player->getInventory()->addItem($item);
                             $get["available"] -= $get["amount"];
                         } else {
                             $this->SignShop->messageManager()->send($player, "You_need_to_free_up_space_from_your_inventory_to_remove_this_Sign");
                             $event->setCancelled();
                             return;
                         }
                     }
                 }
                 $signManager->removeSign($block);
                 $this->SignShop->messageManager()->send($player, "The_Sign_successfully_removed");
                 return;
             } else {
                 $this->SignShop->messageManager()->send($player, "The_selected_Sign_is_not_your");
                 $event->setCancelled();
             }
         }
     }
     $pos = $event->getBlock();
     if ($pos->level->getBlockIdAt($pos->x, $pos->y + 1, $pos->z) == Item::SIGN_POST) {
         $pos->level->setBlock($pos, Block::get(0), true, true);
         $pos->y += 1;
         if ($this->SignShop->getSignManager()->existsSign($pos)) {
             $this->SignShop->getSignManager()->spawnSign($pos);
         }
     }
 }
开发者ID:gitter-badger,项目名称:SignShop,代码行数:43,代码来源:PlayerBlockBreakEvent.php

示例13: onBlockBeak

 public function onBlockBeak(BlockBreakEvent $event)
 {
     $log = $event->getPlayer()->getID();
     if (in_array($log, $this->locations)) {
         $ru = $event->getBlock();
         $zoo = strtolower($event->getPlayer()->getName());
         $this->pos[$zoo] = new Vector3($ru->getX(), $ru->getY(), $ru->getZ());
         $event->getPlayer()->sendMessage("BlockPosition :[x->" . $this->pos[$zoo]->getX() . "y->" . $this->pos[$zoo]->getY() . "z->" . $this->pos[$zoo]->getZ() . "]");
         $event->setCancelled(true);
     }
 }
开发者ID:AndreyNazarchuk,项目名称:Collection-Plugins-PocketMine-Prax,代码行数:11,代码来源:BlockLocations.php

示例14: onBlockBreak

 public function onBlockBreak(BlockBreakEvent $event)
 {
     if ($event->isCancelled()) {
         return;
     } else {
         $event->setCancelled();
     }
     foreach ($event->getBlock()->getDrops($event->getItem()) as $i) {
         $event->getPlayer()->getInventory()->addItem(Item::get(...$i));
     }
 }
开发者ID:stoastye85,项目名称:Plugins,代码行数:11,代码来源:BlockPickUp.php

示例15: onBreak

 public function onBreak(BlockBreakEvent $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


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