mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
World: fixed original promise not getting fulfilled if the chunk became populated=true after a promise was already made (but not fulfilled) to populate it
this could happen if a plugin calls setPopulated(true) on a chunk after a request for its population landed in the queue, but before it actually got processed. In that case, the promise would never get fulfilled.
This commit is contained in:
parent
2fa0a914ff
commit
96cfdc79b8
@ -2869,9 +2869,9 @@ class World implements ChunkManager{
|
|||||||
$this->unregisterChunkLoader($temporaryChunkLoader, $x, $z);
|
$this->unregisterChunkLoader($temporaryChunkLoader, $x, $z);
|
||||||
|
|
||||||
//chunk is already populated; return a pre-resolved promise that will directly fire callbacks assigned
|
//chunk is already populated; return a pre-resolved promise that will directly fire callbacks assigned
|
||||||
$result = new PromiseResolver();
|
$resolver ??= new PromiseResolver();
|
||||||
$result->resolve($chunk);
|
$resolver->resolve($chunk);
|
||||||
return $result->getPromise();
|
return $resolver->getPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user