Fixed RegionLoader not creating default index on first load

This commit is contained in:
Shoghi Cervantes 2014-10-15 16:59:31 +02:00
parent 5dc5aba42c
commit 8abe95309c
3 changed files with 6 additions and 3 deletions

View File

@ -349,7 +349,7 @@ namespace pocketmine {
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
];
$type = ($errno === E_ERROR or $errno === E_WARNING or $errno === E_USER_ERROR or $errno === E_USER_WARNING) ? LogLevel::ERROR : LogLevel::NOTICE;
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;
if(($pos = strpos($errstr, "\n")) !== false){
$errstr = substr($errstr, 0, $pos);
@ -362,6 +362,7 @@ namespace pocketmine {
foreach(($trace = getTrace($trace === null ? 3 : 0, $trace)) as $i => $line){
$logger->debug($line);
}
$lastError = [
"type" => $type,
"message" => $errstr,

View File

@ -43,11 +43,12 @@ class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{
$this->z = $regionZ;
$this->levelProvider = $level;
$this->filePath = $this->levelProvider->getPath() . "region/r.$regionX.$regionZ.mca";
$exists = file_exists($this->filePath);
touch($this->filePath);
$this->filePointer = fopen($this->filePath, "r+b");
stream_set_read_buffer($this->filePointer, 1024 * 16); //16KB
stream_set_write_buffer($this->filePointer, 1024 * 16); //16KB
if(!file_exists($this->filePath)){
if(!$exists){
$this->createBlank();
}else{
$this->loadLocationTable();

View File

@ -53,11 +53,12 @@ class RegionLoader{
$this->z = $regionZ;
$this->levelProvider = $level;
$this->filePath = $this->levelProvider->getPath() . "region/r.$regionX.$regionZ.mcr";
$exists = file_exists($this->filePath);
touch($this->filePath);
$this->filePointer = fopen($this->filePath, "r+b");
stream_set_read_buffer($this->filePointer, 1024 * 16); //16KB
stream_set_write_buffer($this->filePointer, 1024 * 16); //16KB
if(!file_exists($this->filePath)){
if(!$exists){
$this->createBlank();
}else{
$this->loadLocationTable();