mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Fixed world data ::generate() functions putting level.dat in the wrong place if the world path didn't end with a /
This commit is contained in:
parent
4910250a81
commit
308d7c126a
@ -39,6 +39,7 @@ use pocketmine\world\generator\Generator;
|
||||
use pocketmine\world\generator\GeneratorManager;
|
||||
use pocketmine\world\World;
|
||||
use pocketmine\world\WorldCreationOptions;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function strlen;
|
||||
@ -101,7 +102,7 @@ class BedrockWorldData extends BaseNbtWorldData{
|
||||
|
||||
$nbt = new LittleEndianNbtSerializer();
|
||||
$buffer = $nbt->write(new TreeRoot($worldData));
|
||||
file_put_contents($path . "level.dat", Binary::writeLInt(self::CURRENT_STORAGE_VERSION) . Binary::writeLInt(strlen($buffer)) . $buffer);
|
||||
file_put_contents(Path::join($path, "level.dat"), Binary::writeLInt(self::CURRENT_STORAGE_VERSION) . Binary::writeLInt(strlen($buffer)) . $buffer);
|
||||
}
|
||||
|
||||
protected function load() : CompoundTag{
|
||||
|
@ -33,6 +33,7 @@ use pocketmine\world\format\io\exception\CorruptedWorldException;
|
||||
use pocketmine\world\generator\GeneratorManager;
|
||||
use pocketmine\world\World;
|
||||
use pocketmine\world\WorldCreationOptions;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use function ceil;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
@ -68,7 +69,7 @@ class JavaWorldData extends BaseNbtWorldData{
|
||||
|
||||
$nbt = new BigEndianNbtSerializer();
|
||||
$buffer = zlib_encode($nbt->write(new TreeRoot(CompoundTag::create()->setTag("Data", $worldData))), ZLIB_ENCODING_GZIP);
|
||||
file_put_contents($path . "level.dat", $buffer);
|
||||
file_put_contents(Path::join($path, "level.dat"), $buffer);
|
||||
}
|
||||
|
||||
protected function load() : CompoundTag{
|
||||
|
Loading…
x
Reference in New Issue
Block a user