Fixed no params aliases

This commit is contained in:
Shoghi Cervantes Pueyo 2013-05-18 19:04:31 +02:00
parent e3bf38e0b2
commit b48f486620
2 changed files with 18 additions and 7 deletions

View File

@ -195,9 +195,8 @@ class ConsoleAPI{
}
$cmd = strtolower(substr($line, 0, $end));
$params = (string) substr($line, $end + 1);
if(isset($this->alias[$cmd])){
return $this->run($this->alias[$cmd] . " " .$params, $issuer, $cmd);
return $this->run($this->alias[$cmd] . ($params !== "" ? " " .$params:""), $issuer, $cmd);
}
if($issuer instanceof Player){
console("[DEBUG] \x1b[33m".$issuer->username."\x1b[0m issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);

View File

@ -86,6 +86,9 @@ class LevelAPI{
}
public function generateLevel($name, $seed = false, $generator = false){
if($this->levelExists($name)){
return false;
}
$options = array();
if($this->server->api->getProperty("generator-settings") !== false and trim($this->server->api->getProperty("generator-settings")) != ""){
$options["preset"] = $this->server->api->getProperty("generator-settings");
@ -101,19 +104,28 @@ class LevelAPI{
}
$gen = new WorldGenerator($generator, $name, $seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):(int) $seed);
$gen->generate();
return true;
}
public function loadLevel($name){
if($this->get($name) !== false){
return true;
}
public function levelExists($name){
$path = DATA_PATH."worlds/".$name."/";
if(!file_exists($path."level.pmf")){
if($this->get($name) === false and !file_exists($path."level.pmf")){
$level = new LevelImport($path);
if($level->import() === false){
return false;
}
}
return true;
}
public function loadLevel($name){
if($this->get($name) !== false){
return true;
}elseif($this->levelExists($name) === false){
console("[NOTICE] Level \"".$name."\" not found");
return false;
}
$path = DATA_PATH."worlds/".$name."/";
console("[INFO] Preparing level \"".$name."\"");
$level = new PMFLevel($path."level.pmf");
$entities = new Config($path."entities.yml", CONFIG_YAML);