mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
PHP8: use match function
This commit is contained in:
parent
1275a4558c
commit
f74e6e0638
41 changed files with 300 additions and 574 deletions
|
|
@ -145,17 +145,11 @@ class LevelAPI{
|
|||
if($generator !== false and class_exists($generator)){
|
||||
$generator = new $generator($options);
|
||||
}else{
|
||||
switch(strtoupper($this->server->api->getProperty("level-type"))){
|
||||
case "FLAT":
|
||||
$generator = new SuperflatGenerator($options);
|
||||
break;
|
||||
case "VANILLA":
|
||||
$generator = new VanillaGenerator($options);
|
||||
break;
|
||||
default:
|
||||
$generator = new TemporalGenerator($options);
|
||||
break;
|
||||
}
|
||||
$generator = match (strtoupper($this->server->api->getProperty("level-type"))) {
|
||||
"FLAT" => new SuperflatGenerator($options),
|
||||
"VANILLA" => new VanillaGenerator($options),
|
||||
default => new TemporalGenerator($options),
|
||||
};
|
||||
}
|
||||
$gen = new WorldGenerator($generator, $name, $seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)) : (int) $seed);
|
||||
$gen->generate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue