mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
Fixed crashes related to ChunkEvent
This commit is contained in:
parent
77799d8f3d
commit
3495c79c0c
@ -1300,9 +1300,11 @@ class Level implements ChunkManager, Metadatable{
|
||||
$oldChunk = $this->getChunkAt($x, $z);
|
||||
unset($this->chunkGenerationQueue["$x:$z"]);
|
||||
$this->setChunk($x, $z, $chunk);
|
||||
|
||||
if(!($oldChunk instanceof FullChunk) or ($oldChunk->isPopulated() === false and $chunk->isPopulated())){
|
||||
$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($this->getChunkAt($x, $z)));
|
||||
$chunk = $this->getChunkAt($x, $z);
|
||||
if($chunk instanceof FullChunk){
|
||||
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;
|
||||
}
|
||||
|
||||
$this->server->getPluginManager()->callEvent($ev = new ChunkUnloadEvent($this->getChunkAt($x, $z)));
|
||||
if($ev->isCancelled()){
|
||||
return false;
|
||||
$chunk = $this->getChunkAt($x, $z);
|
||||
|
||||
if($chunk instanceof FullChunk){
|
||||
$this->server->getPluginManager()->callEvent($ev = new ChunkUnloadEvent($chunk));
|
||||
if($ev->isCancelled()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->timings->doChunkUnload->startTiming();
|
||||
|
Loading…
x
Reference in New Issue
Block a user