mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Throw exception when attempting to save a non-generated chunk (#367)
This commit is contained in:
@ -477,9 +477,13 @@ class LevelDB extends BaseLevelProvider{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function saveChunk(int $x, int $z) : bool{
|
||||
if($this->isChunkLoaded($x, $z)){
|
||||
$this->writeChunk($this->getChunk($x, $z));
|
||||
public function saveChunk(int $chunkX, int $chunkZ) : bool{
|
||||
if($this->isChunkLoaded($chunkX, $chunkZ)){
|
||||
$chunk = $this->getChunk($chunkX, $chunkZ);
|
||||
if(!$chunk->isGenerated()){
|
||||
throw new \InvalidStateException("Cannot save un-generated chunk");
|
||||
}
|
||||
$this->writeChunk($chunk);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -309,7 +309,11 @@ class McRegion extends BaseLevelProvider{
|
||||
|
||||
public function saveChunk(int $chunkX, int $chunkZ) : bool{
|
||||
if($this->isChunkLoaded($chunkX, $chunkZ)){
|
||||
$this->getRegion($chunkX >> 5, $chunkZ >> 5)->writeChunk($this->getChunk($chunkX, $chunkZ));
|
||||
$chunk = $this->getChunk($chunkX, $chunkZ);
|
||||
if(!$chunk->isGenerated()){
|
||||
throw new \InvalidStateException("Cannot save un-generated chunk");
|
||||
}
|
||||
$this->getRegion($chunkX >> 5, $chunkZ >> 5)->writeChunk($chunk);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user