diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 652f0d24d..1d95aea76 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -275,8 +275,7 @@ class BlockAPI{ if($target->onBreak($item, $player) === false){ return $this->cancelAction($target, $player, false); } - $item->useOn($target); - if($item->getMetadata() >= $item->getMaxDurability()){ + if($item->useOn($target) and ($player->gamemode & 0x01) === 0 and $item->getMetadata() >= $item->getMaxDurability()){ $player->setSlot($player->slot, new Item(AIR, 0, 0), false); } $drops = $target->getDrops($item, $player); diff --git a/src/Player.php b/src/Player.php index 607ce6352..d8dbe183f 100644 --- a/src/Player.php +++ b/src/Player.php @@ -1519,8 +1519,7 @@ class Player{ } $target->harm($damage, $this->eid); if($slot->isTool() === true and ($this->gamemode & 0x01) === 0){ - $slot->useOn($target); - if($slot->getMetadata() >= $slot->getMaxDurability()){ + if($slot->useOn($target) and $slot->getMetadata() >= $slot->getMaxDurability()){ $this->setSlot($this->slot, new Item(AIR, 0, 0), false); } } diff --git a/src/config.php b/src/config.php index d005c6f53..8434ba93b 100644 --- a/src/config.php +++ b/src/config.php @@ -65,7 +65,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH); ini_set("memory_limit", "128M"); //Default define("LOG", true); define("START_TIME", microtime(true)); -define("MAJOR_VERSION", "Alpha_1.3.4"); +define("MAJOR_VERSION", "Alpha_1.3.5dev"); define("CURRENT_MINECRAFT_VERSION", "0.7.3 alpha"); define("CURRENT_API_VERSION", 9); define("CURRENT_PHP_VERSION", "5.5"); diff --git a/src/material/Item.php b/src/material/Item.php index a33502173..e18c36578 100644 --- a/src/material/Item.php +++ b/src/material/Item.php @@ -142,7 +142,9 @@ class Item{ }else{ $this->meta++; } + return true; } + return false; } final public function isTool(){ diff --git a/src/material/item/tool/FlintSteel.php b/src/material/item/tool/FlintSteel.php index 431500f85..bc0eb3e60 100644 --- a/src/material/item/tool/FlintSteel.php +++ b/src/material/item/tool/FlintSteel.php @@ -38,8 +38,7 @@ class FlintSteelItem extends Item{ $block->level->scheduleBlockUpdate(new Position($block, 0, 0, $block->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } - $this->useOn($block); - if($this->getMetadata() >= $this->getMaxDurability()){ + if($this->useOn($block) and ($player->gamemode & 0x01) === 0 and $this->getMetadata() >= $this->getMaxDurability()){ $player->setSlot($player->slot, new Item(AIR, 0, 0), false); } return false;