mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Remove Anvil/McRegion circular dependency, more scalable region validity checks
This commit is contained in:
parent
00158d4805
commit
3848f6f39c
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user