Remove Anvil/McRegion circular dependency, more scalable region validity checks

This commit is contained in:
Dylan K. Taylor 2016-12-23 12:13:32 +00:00
parent 00158d4805
commit 3848f6f39c
2 changed files with 1 additions and 17 deletions

View File

@ -160,22 +160,6 @@ class Anvil extends McRegion{
return "anvil";
}
public static function isValid(string $path) : bool{
$isValid = (file_exists($path . "/level.dat") and is_dir($path . "/region/"));
if($isValid){
$files = glob($path . "/region/*.mc*");
foreach($files as $f){
if(strpos($f, "." . McRegion::REGION_FILE_EXTENSION) !== false){
$isValid = false;
break;
}
}
}
return $isValid;
}
public function getWorldHeight() : int{
//TODO: add world height options
return 256;

View File

@ -211,7 +211,7 @@ class McRegion extends BaseLevelProvider{
if($isValid){
$files = glob($path . "/region/*.mc*");
foreach($files as $f){
if(strpos($f, "." . Anvil::REGION_FILE_EXTENSION) !== false){
if(strpos($f, "." . static::REGION_FILE_EXTENSION) === false){
$isValid = false;
break;
}