mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Chunk: Clean up unnecessary checks in unload()
This commit is contained in:
@ -2780,8 +2780,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: not checking return value, but is it needed anyway?
|
$chunk->unload();
|
||||||
$chunk->unload($safe);
|
|
||||||
}catch(\Throwable $e){
|
}catch(\Throwable $e){
|
||||||
$logger = $this->server->getLogger();
|
$logger = $this->server->getLogger();
|
||||||
$logger->error($this->server->getLanguage()->translateString("pocketmine.level.chunkUnloadError", [$e->getMessage()]));
|
$logger->error($this->server->getLanguage()->translateString("pocketmine.level.chunkUnloadError", [$e->getMessage()]));
|
||||||
|
@ -692,20 +692,8 @@ class Chunk{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads the chunk, closing entities and tiles.
|
* Unloads the chunk, closing entities and tiles.
|
||||||
*
|
|
||||||
* @param bool $safe Whether to check if there are still players using this chunk
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function unload(bool $safe = true) : bool{
|
public function unload() : void{
|
||||||
if($safe){
|
|
||||||
foreach($this->getEntities() as $entity){
|
|
||||||
if($entity instanceof Player){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($this->getEntities() as $entity){
|
foreach($this->getEntities() as $entity){
|
||||||
if($entity instanceof Player){
|
if($entity instanceof Player){
|
||||||
continue;
|
continue;
|
||||||
@ -716,8 +704,6 @@ class Chunk{
|
|||||||
foreach($this->getTiles() as $tile){
|
foreach($this->getTiles() as $tile){
|
||||||
$tile->close();
|
$tile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user