mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Fixed players sleeping on the same bed
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user