beware users putting garbage in pocketmine.yml

This commit is contained in:
Dylan K. Taylor 2017-10-25 12:54:31 +01:00
parent 3b85e558ce
commit 2635c85873

View File

@ -1379,7 +1379,7 @@ class Server{
if(is_array($value)){ if(is_array($value)){
$commands = $value; $commands = $value;
}else{ }else{
$commands[] = $value; $commands[] = (string) $value;
} }
$result[$key] = $commands; $result[$key] = $commands;
@ -1653,6 +1653,9 @@ class Server{
Generator::addGenerator(Nether::class, "nether"); Generator::addGenerator(Nether::class, "nether");
foreach((array) $this->getProperty("worlds", []) as $name => $options){ foreach((array) $this->getProperty("worlds", []) as $name => $options){
if(!is_array($options)){
continue;
}
if($this->loadLevel($name) === false){ if($this->loadLevel($name) === false){
$seed = $options["seed"] ?? time(); $seed = $options["seed"] ?? time();
if(is_string($seed) and !is_numeric($seed)){ if(is_string($seed) and !is_numeric($seed)){