Inheritance: extends BlockEvent, implements pocketmine\event\Cancellable
Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
 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"));
         }
     }
 }
Esempio n. 3
0
 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;
 }
 /** 
  * @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"));
     }
 }
Esempio n. 5
0
 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!");
                 }
             }
         }
     }
 }
 public function onBlockBreakEvent(BlockBreakEvent $event)
 {
     if (!$event->getPlayer()->isOp()) {
         $event->setCancelled(true);
         $this->debug->onDebug('BlockBreakEvent');
     }
 }
Esempio n. 7
0
 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}"]);
     }
 }
Esempio n. 8
0
 /**
  *
  * @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());
         }
     }
 }
 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();
     }
 }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     if (!$player->hasPermission("xperms.build")) {
         $player->sendMessage(TextFormat::RED . $this->plugin->getConfiguration()->getMSGonIBuildPerm());
         $event->setCancelled(true);
     }
 }
 public function onBreak(BlockBreakEvent $event)
 {
     if ($event->getPlayer()->hasPermission("worldprotector.block.break")) {
         $event->setCancelled(false);
     } else {
         $event->setCancelled(true);
     }
 }
Esempio n. 13
0
 /**
  *
  * @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());
         }
     }
 }
Esempio n. 14
0
 public function onBreak(BlockBreakEvent $ev)
 {
     $player = $ev->getPlayer();
     $cfg = $this->config->getAll();
     if ($ev->isCancelled()) {
         $player->setHeatlh($player->getHealth() - $cfg["Damage"]);
         return;
     }
 }
Esempio n. 15
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     if ($player->hasPermission('log.breaked.block')) {
         $this->plugin->addBreakedBlock($block, $player);
         // ADD TIME
     }
 }
Esempio n. 16
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $key = $event->getBlock()->x . "." . $event->getBlock()->y . "." . $event->getBlock()->z;
     foreach ($this->crops as $crop) {
         if ($event->getItem()->getId() == $crop["item"] and isset($this->farmData[$key])) {
             unset($this->farmData[$key]);
         }
     }
 }
Esempio n. 17
0
 /**
  * @param BlockBreakEvent $event
  *
  * @priority HIGHEST
  */
 public function onBreak(BlockBreakEvent $event)
 {
     if ($event->isCancelled()) {
         $p = $event->getPlayer();
         if (isset($this->positions[$p->getName()])) {
             $pos = $this->positions[$p->getName()];
             $this->revert($p, $pos, $pos->yaw, $pos->pitch);
         }
     }
 }
Esempio n. 18
0
 public function onBreak(BlockBreakEvent $event)
 {
     if (!isset($this->wands[$event->getPlayer()->getName()])) {
         $eventname = "Break";
         $this->regi($event, $eventname);
     } else {
         $this->chk($event);
         $event->setCancelled(true);
     }
 }
Esempio n. 19
0
 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);
     }
 }
Esempio n. 20
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $b = $event->getBlock();
     if (isset($this->grow[$this->getPos($b)])) {
         $c = false;
         if ($event->getPlayer()->isCreative()) {
             $c = true;
         }
         $this->beanBreak($b, $c);
     }
 }
Esempio n. 21
0
 /**
  * @priority LOWEST
  * @ignoreCancelled true
  * @param BlockBreakEvent $event
  */
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     $job = $this->jobs->get($this->player->get($player->getName()));
     if ($job !== false) {
         if (isset($job[$block->getID() . ":" . $block->getDamage() . ":break"])) {
             $this->api->addMoney($player, $job[$block->getID() . ":" . $block->getDamage() . ":break"]);
         }
     }
 }
 public function onBreak(BlockBreakEvent $event)
 {
     $block = $event->getBlock();
     if ($block instanceof Crops and !$event->getItem()->isHoe()) {
         if ($block->getId() === Block::PUMPKIN_STEM or $block->getId() === Block::MELON_STEM) {
             $event->setCancelled();
         } else {
             $this->blocks[microtime(true) + mt_rand(1, 5) . "." . mt_rand(0, 5)] = $block;
             $this->runTask();
         }
     }
 }
Esempio n. 23
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     $level = $player->getLevel();
     $spawn = $level->getSpawnLocation();
     $distance = $spawn->distance($player);
     if ($distance <= $this->cfg->get($level->getName())) {
         if (!$player->hasPermission("customradius.edit")) {
             $event->setCancelled(true);
         }
     }
 }
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $block = $event->getBlock();
     $faction = $this->owner->isInPlot($block->getFloorX(), $block->getFloorZ());
     if ($faction) {
         $player = $event->getPlayer();
         if ($faction->getName() !== $this->owner->getPlayerFaction($player) and !$player->hasPermission('uf.break.neutral')) {
             $event->setCancelled(true);
             $player->sendMessage($this->owner->mformatter->formatMessage('This plot has been claimed by: ' . TextFormat::GOLD . $faction . TextFormat::WHITE . ' faction', MessageFormat::INFO));
         }
     }
 }
Esempio n. 25
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     if ($event->isCancelled()) {
         return;
     }
     $b = $event->getBlock();
     foreach ($b->getDrops($event->getItem()) as $i) {
         $this->item[$i[0] . ":" . $i[1] . ":" . $i[2]] = true;
         for ($for = 0; $for < $this->getCount(); $for++) {
             $b->getLevel()->dropItem($b, Item::get($i[0], $i[1], $i[2]));
         }
     }
 }
Esempio n. 26
0
 public function onBreak(BlockBreakEvent $bbe)
 {
     $pl = $bbe->getPlayer();
     $name = $pl->getName();
     $bl = $bbe->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 . " Destroyed/tried to Destroy (a)" . C::YELLOW . " {$blname}" . C::DARK_AQUA . " in World:" . C::YELLOW . " {$lvl}" . C::DARK_AQUA . " at Position:" . C::YELLOW . " {$x}, {$y}, {$z}");
     return;
 }
 public function onBreak(BlockBreakEvent $event)
 {
     //ItemDamageBug
     $player = $event->getPlayer();
     $item = $event->getItem();
     if ($item->isTool() and !$event->isCancelled() and self::ENABLE_ITEM_DAMAGE_BUG) {
         if ($item->useOn($event->getBlock()) and $item->getDamage() >= $item->getMaxDurability()) {
             $player->getInventory()->setItemInHand(Item::get(Item::AIR, 0, 1));
         } else {
             $player->getInventory()->setItemInHand($item);
         }
     }
 }
Esempio n. 28
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("warp.del")) {
         return;
     }
     $loc = $this->encodeLoc($event->getBlock());
     if (!isset(self::$warpData[$loc])) {
         return;
     }
     unset(self::$warpData[$loc]);
     $event->getPlayer()->sendMessage(TextFormat::AQUA . "Successfully deleted the warp.");
     $this->saveWarpData();
 }
Esempio n. 29
0
 public function onBlockBreak(BlockBreakEvent $event)
 {
     $block = $event->getBlock();
     $blockid = $block->getID();
     $itemid = $event->getItem()->getID();
     foreach ($this->growids as $index => $growid) {
         if ($itemid == $growid) {
             if (isset($this->farmdata[$block->x . "." . $block->y . "." . $block->z])) {
                 unset($this->farmdata[$block->x . "." . $block->y . "." . $block->z]);
             }
         }
     }
 }
Esempio n. 30
-1
 public function BlockBreakEven(BlockBreakEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->getInventory()->getItemInHand()->getId() == 286) {
         $event->setCancelled(true);
     }
     if ($player->getInventory()->getItemInHand()->getId() == 285) {
         $event->setCancelled(true);
     }
 }