forked from Ad5001/BetterGen
Updated code for converting seed to int
This commit is contained in:
parent
db96352150
commit
946ff01874
1 changed files with 14 additions and 18 deletions
|
@ -127,15 +127,13 @@ class Main extends PluginBase implements Listener {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$generatorName = strtolower($args[1]);
|
$generatorName = strtolower($args[1]);
|
||||||
// if (preg_match("[^\d]", $args[2]) !== false) {
|
$parts = str_split($seed);
|
||||||
// $parts = str_split($args[2]);
|
foreach ($parts as $key=>$str) {
|
||||||
// foreach ($parts as $key => $str) {
|
if(is_numeric($str) == false && $str <> '-'){
|
||||||
// $parts[$key] = ord($str);
|
$parts[$key] = ord($str);
|
||||||
// }
|
}
|
||||||
// $seed = implode("", $parts);
|
$seed = (int)implode("", $parts);
|
||||||
// } else {
|
}
|
||||||
$seed = $args[2];
|
|
||||||
// }
|
|
||||||
$options = [];
|
$options = [];
|
||||||
break;
|
break;
|
||||||
default : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
|
default : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
|
||||||
|
@ -147,15 +145,13 @@ class Main extends PluginBase implements Listener {
|
||||||
}
|
}
|
||||||
$generatorName = strtolower($args[1]);
|
$generatorName = strtolower($args[1]);
|
||||||
if ($args[2] == "rand") $args[2] = $this->generateRandomSeed();
|
if ($args[2] == "rand") $args[2] = $this->generateRandomSeed();
|
||||||
if (preg_match("[^\d]", $args[2]) !== false) {
|
$parts = str_split($seed);
|
||||||
$parts = str_split($args[2]);
|
foreach ($parts as $key=>$str) {
|
||||||
foreach ($parts as $key => $str) {
|
if(is_numeric($str) == false && $str <> '-'){
|
||||||
$parts[$key] = ord($str);
|
$parts[$key] = ord($str);
|
||||||
}
|
}
|
||||||
$seed = implode("", $parts);
|
$seed = (int)implode("", $parts);
|
||||||
} else {
|
}
|
||||||
$seed = $args[2];
|
|
||||||
}
|
|
||||||
unset($args[0], $args[1], $args[2]);
|
unset($args[0], $args[1], $args[2]);
|
||||||
$options = json_decode($args[3], true);
|
$options = json_decode($args[3], true);
|
||||||
if (!is_array($options)) {
|
if (!is_array($options)) {
|
||||||
|
|
Loading…
Reference in a new issue