From 9082cfbc2695a04159db0ee3ad60a10c4675c27b Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 17 Feb 2024 12:45:38 +0300 Subject: [PATCH] fixed checkSleep --- src/entity/Entity.php | 2 +- src/world/Level.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index c90a8e35..84c9ce2e 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1305,7 +1305,7 @@ class Entity extends Position 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) diff --git a/src/world/Level.php b/src/world/Level.php index 31016f53..c2e4f7bb 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -277,13 +277,13 @@ class Level{ public function checkSleep(){ //TODO events? 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){ if($p->isSleeping == false || $p->sleepingTime < 100){ return false; } } - $this->server->api->time->set("day", $this->level); + $this->server->api->time->set("day", $this); } foreach($this->players as $p){ $p->stopSleep();