PluginsCommand: clean up garbage code

This commit is contained in:
Dylan K. Taylor 2018-08-25 16:05:25 +01:00
parent c123f2d10b
commit 298259b473

View File

@ -25,6 +25,7 @@ namespace pocketmine\command\defaults;
use pocketmine\command\CommandSender; use pocketmine\command\CommandSender;
use pocketmine\lang\TranslationContainer; use pocketmine\lang\TranslationContainer;
use pocketmine\plugin\Plugin;
use pocketmine\utils\TextFormat; use pocketmine\utils\TextFormat;
class PluginsCommand extends VanillaCommand{ class PluginsCommand extends VanillaCommand{
@ -48,15 +49,10 @@ class PluginsCommand extends VanillaCommand{
} }
private function sendPluginList(CommandSender $sender){ private function sendPluginList(CommandSender $sender){
$list = ""; $list = array_map(function(Plugin $plugin) : string{
foreach(($plugins = $sender->getServer()->getPluginManager()->getPlugins()) as $plugin){ return ($plugin->isEnabled() ? TextFormat::GREEN : TextFormat::RED) . $plugin->getDescription()->getFullName();
if(strlen($list) > 0){ }, $sender->getServer()->getPluginManager()->getPlugins());
$list .= TextFormat::WHITE . ", ";
}
$list .= $plugin->isEnabled() ? TextFormat::GREEN : TextFormat::RED;
$list .= $plugin->getDescription()->getFullName();
}
$sender->sendMessage(new TranslationContainer("pocketmine.command.plugins.success", [count($plugins), $list])); $sender->sendMessage(new TranslationContainer("pocketmine.command.plugins.success", [count($list), implode(TextFormat::WHITE . ", ", $list)]));
} }
} }