mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-31 15:31:07 +00:00
PluginsCommand: clean up garbage code
This commit is contained in:
parent
c123f2d10b
commit
298259b473
@ -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)]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user