mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +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";
|
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{
|
public function getWorldHeight() : int{
|
||||||
//TODO: add world height options
|
//TODO: add world height options
|
||||||
return 256;
|
return 256;
|
||||||
|
@ -211,7 +211,7 @@ class McRegion extends BaseLevelProvider{
|
|||||||
if($isValid){
|
if($isValid){
|
||||||
$files = glob($path . "/region/*.mc*");
|
$files = glob($path . "/region/*.mc*");
|
||||||
foreach($files as $f){
|
foreach($files as $f){
|
||||||
if(strpos($f, "." . Anvil::REGION_FILE_EXTENSION) !== false){
|
if(strpos($f, "." . static::REGION_FILE_EXTENSION) === false){
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user