mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +00:00
Merge branch 'release/3.3'
This commit is contained in:
commit
f23bba053b
@ -35,7 +35,6 @@ class RegionLoader{
|
|||||||
|
|
||||||
public const MAX_SECTOR_LENGTH = 256 << 12; //256 sectors, (1 MiB)
|
public const MAX_SECTOR_LENGTH = 256 << 12; //256 sectors, (1 MiB)
|
||||||
public const REGION_HEADER_LENGTH = 8192; //4096 location table + 4096 timestamps
|
public const REGION_HEADER_LENGTH = 8192; //4096 location table + 4096 timestamps
|
||||||
public const MAX_REGION_FILE_SIZE = 32 * 32 * self::MAX_SECTOR_LENGTH + self::REGION_HEADER_LENGTH; //32 * 32 1MiB chunks + header size
|
|
||||||
|
|
||||||
public static $COMPRESSION_LEVEL = 7;
|
public static $COMPRESSION_LEVEL = 7;
|
||||||
|
|
||||||
@ -58,13 +57,8 @@ class RegionLoader{
|
|||||||
$exists = file_exists($this->filePath);
|
$exists = file_exists($this->filePath);
|
||||||
if(!$exists){
|
if(!$exists){
|
||||||
touch($this->filePath);
|
touch($this->filePath);
|
||||||
}else{
|
}elseif(filesize($this->filePath) % 4096 !== 0){
|
||||||
$fileSize = filesize($this->filePath);
|
throw new CorruptedRegionException("Region file should be padded to a multiple of 4KiB");
|
||||||
if($fileSize > self::MAX_REGION_FILE_SIZE){
|
|
||||||
throw new CorruptedRegionException("Corrupted oversized region file found, should be a maximum of " . self::MAX_REGION_FILE_SIZE . " bytes, got " . $fileSize . " bytes");
|
|
||||||
}elseif($fileSize % 4096 !== 0){
|
|
||||||
throw new CorruptedRegionException("Region file should be padded to a multiple of 4KiB");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->filePointer = fopen($this->filePath, "r+b");
|
$this->filePointer = fopen($this->filePath, "r+b");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user