mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Merge branch 'release/3.3'
This commit is contained in:
commit
3eca64e893
@ -240,6 +240,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
/** @var int */
|
||||
public $tickRateCounter = 0;
|
||||
|
||||
/** @var bool */
|
||||
private $doingTick = false;
|
||||
|
||||
/** @var string|Generator */
|
||||
private $generator;
|
||||
|
||||
@ -532,8 +535,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @param bool $force default false, force unload of default level
|
||||
*
|
||||
* @return bool
|
||||
* @throws \InvalidStateException if trying to unload a level during level tick
|
||||
*/
|
||||
public function unload(bool $force = false) : bool{
|
||||
if($this->doingTick and !$force){
|
||||
throw new \InvalidStateException("Cannot unload a level during level tick");
|
||||
}
|
||||
|
||||
$ev = new LevelUnloadEvent($this);
|
||||
|
||||
@ -693,7 +700,16 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
$this->timings->doTick->startTiming();
|
||||
$this->doingTick = true;
|
||||
try{
|
||||
$this->actuallyDoTick($currentTick);
|
||||
}finally{
|
||||
$this->doingTick = false;
|
||||
$this->timings->doTick->stopTiming();
|
||||
}
|
||||
}
|
||||
|
||||
protected function actuallyDoTick(int $currentTick) : void{
|
||||
if(!$this->stopTime){
|
||||
$this->time++;
|
||||
}
|
||||
@ -819,8 +835,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
$this->chunkPackets = [];
|
||||
|
||||
$this->timings->doTick->stopTiming();
|
||||
}
|
||||
|
||||
public function checkSleep(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user