mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +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);
|
||||
|
||||
//chunk is already populated; return a pre-resolved promise that will directly fire callbacks assigned
|
||||
$result = new PromiseResolver();
|
||||
$result->resolve($chunk);
|
||||
return $result->getPromise();
|
||||
$resolver ??= new PromiseResolver();
|
||||
$resolver->resolve($chunk);
|
||||
return $resolver->getPromise();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user