mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
fixed checkSleep
This commit is contained in:
parent
2927fe1094
commit
9082cfbc26
2 changed files with 3 additions and 3 deletions
|
|
@ -1305,7 +1305,7 @@ class Entity extends Position
|
||||||
|
|
||||||
public function getPosition($round = false)
|
public function getPosition($round = false)
|
||||||
{
|
{
|
||||||
return ! isset($this->position) ? false : ($round === true ? array_map("floor", $this->position) : $this->position);
|
return !isset($this->position) ? false : ($round === true ? array_map("floor", $this->position) : $this->position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function harm($dmg, $cause = "generic", $force = false)
|
public function harm($dmg, $cause = "generic", $force = false)
|
||||||
|
|
|
||||||
|
|
@ -277,13 +277,13 @@ class Level{
|
||||||
|
|
||||||
public function checkSleep(){ //TODO events?
|
public function checkSleep(){ //TODO events?
|
||||||
if(count($this->players) == 0) return false;
|
if(count($this->players) == 0) return false;
|
||||||
if($this->server->api->time->getPhase($this->level) === "night"){ //TODO vanilla
|
if($this->server->api->time->getPhase($this) === "night"){ //TODO vanilla
|
||||||
foreach($this->players as $p){
|
foreach($this->players as $p){
|
||||||
if($p->isSleeping == false || $p->sleepingTime < 100){
|
if($p->isSleeping == false || $p->sleepingTime < 100){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->server->api->time->set("day", $this->level);
|
$this->server->api->time->set("day", $this);
|
||||||
}
|
}
|
||||||
foreach($this->players as $p){
|
foreach($this->players as $p){
|
||||||
$p->stopSleep();
|
$p->stopSleep();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue