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


PHP block\BlockBreakEvent类代码示例

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


在下文中一共展示了BlockBreakEvent类的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

 public function onBlockBreak(BlockBreakEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $pl = $ev->getPlayer();
     if (!$this->getState($pl, false)) {
         return;
     }
     if (!$pl->isCreative() || !$this->creative) {
         if ($this->items && !isset($this->items[$ev->getItem()->getId()])) {
             echo "Not using an Axe\n";
             //##DEBUG
             return;
         }
     }
     if ($this->leaves) {
         $damage = $this->destroyTree($ev->getBlock());
     } else {
         $damage = $this->destroyTrunk($ev->getBlock());
     }
     if ($damage && $this->items && $this->itemwear) {
         $hand = $pl->getInventory()->getItemInHand();
         $hand->setDamage($hand->getDamage() + $this->itemwear * $damage);
         $pl->getInventory()->setItemInHand($hand);
         if ($this->broadcast) {
             $this->owner->getServer()->broadcastMessage(mc::_("%1% used TreeCapitator", $pl->getName()));
         } else {
             $pl->sendMessage(mc::_("Used TreeCapitator"));
         }
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:32,代码来源:TreeCapitator.php

示例3: 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

示例4: 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

示例5: onBreak

 public function onBreak(BlockBreakEvent $event)
 {
     if ($event->getBlock() instanceof Bed) {
         foreach ($this->getConfig()->get("Arenas") as $arena => $g) {
             $bx = $event->getBlock()->getX();
             $by = $event->getBlock()->getY();
             $bz = $event->getBlock()->getZ();
             $blockpos = new Position($bx, $by, $bz);
             $bl = $event->getBlock()->getLevel()->getName();
             $bpos = $g["bluebed"];
             $rpos = $g["redbed"];
             $gpos = $g["greenbed"];
             $ypos = $g["yellowbed"];
             if ($blockpos === $bpos and $bl === $g["world"]) {
                 foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
                     $p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::BLUE . "Blu" . TextFormat::DARK_GRAY . "! I giocatori blu sono stati eliminati!");
                 }
             } elseif ($blockpos === $rpos and $bl === $g["world"]) {
                 foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
                     $p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::RED . "Rosso" . TextFormat::DARK_GRAY . "! I giocatori rossi sono stati eliminati!");
                 }
             } elseif ($blockpos === $gpos and $bl === $g["world"]) {
                 foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
                     $p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::GREEN . "Verde" . TextFormat::DARK_GRAY . "! I giocatori verdi sono stati eliminati!");
                 }
             } elseif ($blockpos === $ypos and $bl === $g["world"]) {
                 foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
                     $p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::YELLOW . "Giallo" . TextFormat::DARK_GRAY . "! I giocatori gialli sono stati eliminati!");
                 }
             }
         }
     }
 }
开发者ID:AbelGamerC,项目名称:BedWars,代码行数:33,代码来源:Main.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: SignBreak

 public function SignBreak(BlockBreakEvent $event)
 {
     $block = $event->getBlock();
     if (isset($this->configData["{$block->x}:{$block->y}:{$block->z}"])) {
         unset($this->configData["{$block->x}:{$block->y}:{$block->z}"]);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:7,代码来源:SignCommand.php

示例8: onBlockBreak

 /**
  *
  * @param BlockBreakEvent $event        	
  */
 public function onBlockBreak(BlockBreakEvent $event)
 {
     if ($event->getPlayer() instanceof Player) {
         if ($this->plugin->gameLevelManager->setupModeAction === GameLevelManager::COMMAND_SETUP_WAND_GAME_LEVEL || $this->plugin->gameLevelManager->setupModeAction === GameLevelManager::COMMAND_SETUP_WAND_GAME_LEVEL_GATE) {
             $this->plugin->gameLevelManager->handleBlockBreakSelection($event->getPlayer(), $event->getBlock());
         }
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:12,代码来源:GameLevelListener.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)
 {
     $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

示例12: 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

示例13: onBlockBreak

 /**
  *
  * @param BlockBreakEvent $event        	
  */
 public function onBlockBreak(BlockBreakEvent $event)
 {
     if ($event->getPlayer() instanceof Player) {
         if ($this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_MAIN || $this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_MAIN_PLAYER_SPAWNS || $this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_DEATH_MATCH || $this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_DEATH_MATCH_SPAWN) {
             $this->plugin->arenaManager->handleBlockBreakSelection($event->getPlayer(), $event->getBlock());
         }
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:12,代码来源:MapArenaListener.php

示例14: onBreak

 public function onBreak(BlockBreakEvent $ev)
 {
     $player = $ev->getPlayer();
     $cfg = $this->config->getAll();
     if ($ev->isCancelled()) {
         $player->setHeatlh($player->getHealth() - $cfg["Damage"]);
         return;
     }
 }
开发者ID:Skull3x,项目名称:DamageOnBreak,代码行数:9,代码来源:Main.php

示例15: onBlockBreak

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


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