mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Correctly sort /plugins list for player commandsenders
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||||
|
Date: Sat, 4 Jul 2020 13:49:56 -0500
|
||||||
|
Subject: [PATCH] Correctly sort /plugins list for player commandsenders
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||||
|
index 665211cb1..fb58bdc81 100644
|
||||||
|
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||||
|
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||||
|
@@ -90,11 +90,19 @@ public class PluginsCommand extends BukkitCommand {
|
||||||
|
// Spigot start
|
||||||
|
@NotNull
|
||||||
|
private BaseComponent[] getPluginListSpigot() {
|
||||||
|
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
||||||
|
- ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.length + "): ");
|
||||||
|
+ // Purpur 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() + "): ");
|
||||||
|
+ // Purpur end
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
- for (Plugin plugin : plugins) {
|
||||||
|
+ // Purpur start
|
||||||
|
+ for (Map.Entry<String, Plugin> entry : plugins.entrySet()) {
|
||||||
|
+ Plugin plugin = entry.getValue();
|
||||||
|
+ // Purpur end
|
||||||
|
if (index++ > 0) {
|
||||||
|
pluginList.append(", ", FormatRetention.NONE).color(net.md_5.bungee.api.ChatColor.WHITE);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user