Fixed players sleeping on the same bed

This commit is contained in:
Shoghi Cervantes
2013-09-04 12:36:50 +02:00
parent dd5b1869e2
commit bee3e7d67a
2 changed files with 15 additions and 3 deletions

View File

@ -29,11 +29,15 @@ class BedBlock extends TransparentBlock{
public function onActivate(Item $item, Player $player){
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
$player->dataPacket(MC_CLIENT_MESSAGE, array(
"message" => "You can only sleep at night."
"message" => "You can only sleep at night"
));
return true;
}
$player->sleepOn($this);
if($player->sleepOn($this) === false){
$player->dataPacket(MC_CLIENT_MESSAGE, array(
"message" => "This bed is occupied"
));
}
return true;
}