mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Fixed crashes related to ChunkEvent
This commit is contained in:
@ -1300,9 +1300,11 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$oldChunk = $this->getChunkAt($x, $z);
|
$oldChunk = $this->getChunkAt($x, $z);
|
||||||
unset($this->chunkGenerationQueue["$x:$z"]);
|
unset($this->chunkGenerationQueue["$x:$z"]);
|
||||||
$this->setChunk($x, $z, $chunk);
|
$this->setChunk($x, $z, $chunk);
|
||||||
|
$chunk = $this->getChunkAt($x, $z);
|
||||||
if(!($oldChunk instanceof FullChunk) or ($oldChunk->isPopulated() === false and $chunk->isPopulated())){
|
if($chunk instanceof FullChunk){
|
||||||
$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($this->getChunkAt($x, $z)));
|
if(!($oldChunk instanceof FullChunk) or ($oldChunk->isPopulated() === false and $chunk->isPopulated())){
|
||||||
|
$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1569,9 +1571,13 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server->getPluginManager()->callEvent($ev = new ChunkUnloadEvent($this->getChunkAt($x, $z)));
|
$chunk = $this->getChunkAt($x, $z);
|
||||||
if($ev->isCancelled()){
|
|
||||||
return false;
|
if($chunk instanceof FullChunk){
|
||||||
|
$this->server->getPluginManager()->callEvent($ev = new ChunkUnloadEvent($chunk));
|
||||||
|
if($ev->isCancelled()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->timings->doChunkUnload->startTiming();
|
$this->timings->doChunkUnload->startTiming();
|
||||||
|
Reference in New Issue
Block a user