From 949ab34b42441923d78a03911f86e99d7de4b0ef Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sat, 30 Mar 2013 20:26:15 +0100 Subject: [PATCH] Added player.block.(break/place).invalid handling events --- src/API/BlockAPI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index d67c2cdaa..9e3cbbf34 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -170,7 +170,7 @@ class BlockAPI{ return $this->cancelAction($target, $player); } - if(!$target->isBreakable($item, $player) or $player->gamemode === ADVENTURE or ($player->lastBreak + $target->getBreakTime($item, $player)) >= microtime(true)){ + if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or $player->gamemode === ADVENTURE or ($player->lastBreak + $target->getBreakTime($item, $player)) >= microtime(true)){ return $this->cancelAction($target, $player); } @@ -225,7 +225,7 @@ class BlockAPI{ $block = $this->getBlockFace($target, $face); $item = $player->equipment; - if($target->getID() === AIR){ //If no block exists + if($target->getID() === AIR and $this->server->api->dhandle("player.block.place.invalid", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== true){ //If no block exists $this->cancelAction($target, $player); return $this->cancelAction($block, $player); }