pocketmine\level\format\generic\BaseFullChunk::unload PHP Method

unload() public method

public unload ( $save = true, $safe = true )
    public function unload($save = true, $safe = true)
    {
        $level = $this->getProvider();
        if ($level === null) {
            return true;
        }
        if ($save === true and $this->hasChanged) {
            $level->saveChunk($this->getX(), $this->getZ());
        }
        if ($safe === true) {
            foreach ($this->getEntities() as $entity) {
                if ($entity instanceof Player) {
                    return false;
                }
            }
        }
        foreach ($this->getEntities() as $entity) {
            if ($entity instanceof Player) {
                continue;
            }
            $entity->close();
        }
        foreach ($this->getTiles() as $tile) {
            $tile->close();
        }
        $this->provider = null;
        return true;
    }