small cleanup help-manager

This commit is contained in:
kremsy 2015-01-19 19:18:26 +01:00
parent f0a33ac5a2
commit 95a6e3e6a3

View File

@ -19,7 +19,6 @@ use ManiaControl\Players\Player;
* @copyright 2014-2015 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class HelpManager implements CommandListener, CallbackListener {
/*
* Private properties
@ -62,7 +61,7 @@ class HelpManager implements CommandListener, CallbackListener {
$message = $this->parseHelpList($this->adminCommands);
// Show message when it's not empty
if($message != NULL){
if ($message != null) {
$message = 'Supported Admin Commands: ' . $message;
$this->maniaControl->getChat()->sendChat($message, $player);
}
@ -79,7 +78,7 @@ class HelpManager implements CommandListener, CallbackListener {
$message = $this->parseHelpList($this->playerCommands);
// Show message when it's not empty
if($message != NULL){
if ($message != null) {
$message = 'Supported Player Commands: ' . $message;
$this->maniaControl->getChat()->sendChat($message, $player);
}
@ -97,6 +96,7 @@ class HelpManager implements CommandListener, CallbackListener {
/**
* Parse list with commands from array
*
* @param array $commands
* @param bool $isHelpAll
* @param Player $player
@ -108,7 +108,7 @@ class HelpManager implements CommandListener, CallbackListener {
$message = '';
foreach (array_reverse($commands) as $command) {
if (array_key_exists($command['Method'], $registeredMethods)) {
if($showCommands[$registeredMethods[$command['Method']]]['Description'] === $command['Description']) {
if ($showCommands[$registeredMethods[$command['Method']]]['Description'] === $command['Description']) {
$name = $registeredMethods[$command['Method']];
$showCommands[$name]['Name'] .= '|' . $command['Name'];
} else {
@ -125,20 +125,17 @@ class HelpManager implements CommandListener, CallbackListener {
return strcmp($commandA['Name'], $commandB['Name']);
});
if(!$isHelpAll){
if (!$isHelpAll) {
foreach ($showCommands as $command) {
$message .= $command['Name'] . ',';
}
$message = substr($message, 0, -1);
return $message;
}else{
if($player != NULL){
} else {
if ($player != null) {
$this->showHelpAllList($showCommands, $player);
}
}
return;
return $message;
}
/**