SimpleCommandMap: clean up error reporting in registerServerAliases()

This commit is contained in:
Dylan K. Taylor 2018-08-25 15:43:23 +01:00
parent 9d80802e53
commit c123f2d10b

View File

@ -302,9 +302,9 @@ class SimpleCommandMap implements CommandMap{
} }
$targets = []; $targets = [];
$bad = [];
$recursive = [];
$bad = "";
$recursive = "";
foreach($commandStrings as $commandString){ foreach($commandStrings as $commandString){
$args = explode(" ", $commandString); $args = explode(" ", $commandString);
$commandName = ""; $commandName = "";
@ -312,27 +312,21 @@ class SimpleCommandMap implements CommandMap{
if($command === null){ if($command === null){
if(strlen($bad) > 0){ $bad[] = $commandString;
$bad .= ", ";
}
$bad .= $commandString;
}elseif($commandName === $alias){ }elseif($commandName === $alias){
if($recursive !== ""){ $recursive[] = $commandString;
$recursive .= ", ";
}
$recursive .= $commandString;
}else{ }else{
$targets[] = $commandString; $targets[] = $commandString;
} }
} }
if($recursive !== ""){ if(!empty($recursive)){
$this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.recursive", [$alias, $recursive])); $this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.recursive", [$alias, implode(", ", $recursive)]));
continue; continue;
} }
if(strlen($bad) > 0){ if(!empty($bad)){
$this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.notFound", [$alias, $bad])); $this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.notFound", [$alias, implode(", ", $bad)]));
continue; continue;
} }