mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
PluginsCommand: sort plugins list into lexical order
This commit is contained in:
parent
57b6451e16
commit
b747899fdd
@ -30,6 +30,8 @@ use pocketmine\utils\TextFormat;
|
|||||||
use function array_map;
|
use function array_map;
|
||||||
use function count;
|
use function count;
|
||||||
use function implode;
|
use function implode;
|
||||||
|
use function sort;
|
||||||
|
use const SORT_STRING;
|
||||||
|
|
||||||
class PluginsCommand extends VanillaCommand{
|
class PluginsCommand extends VanillaCommand{
|
||||||
|
|
||||||
@ -51,6 +53,7 @@ class PluginsCommand extends VanillaCommand{
|
|||||||
$list = array_map(function(Plugin $plugin) : string{
|
$list = array_map(function(Plugin $plugin) : string{
|
||||||
return ($plugin->isEnabled() ? TextFormat::GREEN : TextFormat::RED) . $plugin->getDescription()->getFullName();
|
return ($plugin->isEnabled() ? TextFormat::GREEN : TextFormat::RED) . $plugin->getDescription()->getFullName();
|
||||||
}, $sender->getServer()->getPluginManager()->getPlugins());
|
}, $sender->getServer()->getPluginManager()->getPlugins());
|
||||||
|
sort($list, SORT_STRING);
|
||||||
|
|
||||||
$sender->sendMessage(new TranslationContainer("pocketmine.command.plugins.success", [count($list), implode(TextFormat::WHITE . ", ", $list)]));
|
$sender->sendMessage(new TranslationContainer("pocketmine.command.plugins.success", [count($list), implode(TextFormat::WHITE . ", ", $list)]));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user