當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。