mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Fix /plugins list not alphabetical to players (#3790)
This commit is contained in:
parent
7de9b9d112
commit
3cf7163de4
1 changed files with 24 additions and 3 deletions
|
@ -26,12 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
||||
+ // Paper start
|
||||
+ TreeMap<String, Plugin> plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
- for (Plugin plugin : plugins) {
|
||||
+
|
||||
+ for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
+ plugins.put(plugin.getDescription().getName(), plugin);
|
||||
+ }
|
||||
+
|
||||
|
||||
- for (Plugin plugin : plugins) {
|
||||
+ StringBuilder pluginList = new StringBuilder();
|
||||
+ for (Map.Entry<String, Plugin> entry : plugins.entrySet()) {
|
||||
if (pluginList.length() > 0) {
|
||||
|
@ -58,3 +58,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
// Spigot start
|
||||
@NotNull
|
||||
private BaseComponent[] getPluginListSpigot() {
|
||||
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
||||
- ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.length + "): ");
|
||||
+ // Paper start
|
||||
+ TreeMap<String, Plugin> plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
+ for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
+ plugins.put(plugin.getDescription().getName(), plugin);
|
||||
+ }
|
||||
+ ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.size() + "): ");
|
||||
+ // Paper end
|
||||
|
||||
int index = 0;
|
||||
- for (Plugin plugin : plugins) {
|
||||
+ // Paper start
|
||||
+ for (Map.Entry<String, Plugin> entry : plugins.entrySet()) {
|
||||
+ Plugin plugin = entry.getValue();
|
||||
+ // Paper end
|
||||
if (index++ > 0) {
|
||||
pluginList.append(", ", FormatRetention.NONE).color(net.md_5.bungee.api.ChatColor.WHITE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue