mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Generator: fixed incorrect negative seed parsing in convertSeed()
This commit is contained in:
parent
7fc45bc5c3
commit
f714ed6e90
@ -30,7 +30,7 @@ use pocketmine\level\ChunkManager;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\utils\Utils;
|
||||
use function ctype_digit;
|
||||
use function preg_match;
|
||||
|
||||
abstract class Generator{
|
||||
|
||||
@ -44,7 +44,7 @@ abstract class Generator{
|
||||
public static function convertSeed(string $seed) : ?int{
|
||||
if($seed === ""){ //empty seed should cause a random seed to be selected - can't use 0 here because 0 is a valid seed
|
||||
$convertedSeed = null;
|
||||
}elseif(ctype_digit($seed)){ //this avoids treating seeds like "404.4" as integer seeds
|
||||
}elseif(preg_match('/^-?\d+$/', $seed) === 1){ //this avoids treating seeds like "404.4" as integer seeds
|
||||
$convertedSeed = (int) $seed;
|
||||
}else{
|
||||
$convertedSeed = Utils::javaStringHash($seed);
|
||||
|
Loading…
x
Reference in New Issue
Block a user