diff --git a/src/material/block/misc/Bed.php b/src/material/block/misc/Bed.php index 4f34e2ec3..fd05b8d77 100644 --- a/src/material/block/misc/Bed.php +++ b/src/material/block/misc/Bed.php @@ -27,7 +27,7 @@ the Free Software Foundation, either version 3 of the License, or class BedBlock extends TransparentBlock{ public function __construct($type = 0){ - parent::__construct(BED_BLOCK, $type, "Bed"); + parent::__construct(BED_BLOCK, $type, "Bed Block"); $this->isActivable = true; } @@ -57,37 +57,39 @@ class BedBlock extends TransparentBlock{ public function onBreak(BlockAPI $level, Item $item, Player $player){ if($this->inWorld === true){//Checks if the block was in the world or not. Just in case - $blockNorth = $level->getBlockFace($this, 2);//Gets the blocks around them + $blockNorth = $level->getBlockFace($this, 2); //Gets the blocks around them $blockSouth = $level->getBlockFace($this, 3); $blockEast = $level->getBlockFace($this, 5); $blockWest = $level->getBlockFace($this, 4); - if(($this->meta & 0x08) === 0x08){//This is the Top part of bed - - if($blockNorth->getID() === $this->id and $blockNorth->meta != 0x08)//Checks if the block ID and meta are right + if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed + if($blockNorth->getID() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right $level->setBlock($blockNorth, 0, 0); - if($blockSouth->getID() === $this->id and $blockSouth->meta != 0x08) + }elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){ $level->setBlock($blockSouth, 0, 0); - if($blockEast->getID() === $this->id and $blockEast->meta != 0x08) + }elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){ $level->setBlock($blockEast, 0, 0); - if($blockWest->getID() === $this->id and $blockWest->meta != 0x08) + }elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){ $level->setBlock($blockWest, 0, 0); - } - else - { - if(($this->meta & 0x08) != 0x08)//Bottom Part of Bed - { - if($blockNorth->getID() === $this->id and $blockNorth->meta === 0x08) - $level->setBlock($blockNorth, 0, 0); - if($blockSouth->getID() === $this->id and $blockSouth->meta === 0x08) - $level->setBlock($blockSouth, 0, 0); - if($blockEast->getID() === $this->id and $blockEast->meta === 0x08) - $level->setBlock($blockEast, 0, 0); - if($blockWest->getID() === $this->id and $blockWest->meta === 0x08) - $level->setBlock($blockWest, 0, 0); - + }else{ + return false; } + return true; + }else{ //Bottom Part of Bed + if($blockNorth->getID() === $this->id and $blockNorth->meta === 0x08){ + $level->setBlock($blockNorth, 0, 0); + }elseif($blockSouth->getID() === $this->id and $blockSouth->meta === 0x08){ + $level->setBlock($blockSouth, 0, 0); + }elseif($blockEast->getID() === $this->id and $blockEast->meta === 0x08){ + $level->setBlock($blockEast, 0, 0); + }elseif($blockWest->getID() === $this->id and $blockWest->meta === 0x08){ + $level->setBlock($blockWest, 0, 0); + }else{ + return false; + } + return true; } + return false; } }