Paper/Spigot-API-Patches/0063-Make-plugins-list-alphabetical.patch
Aikar 36f34f01c0
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots
3abebc9f #492: Let Tameable extend Animals rather than Entity
941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent
4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME

CraftBukkit Changes:
933e9094 #664: Add methods to get/set ItemStacks in EquipmentSlots
18722312 #662: Expose ItemStack and hand used in PlayerShearEntityEvent
2020-05-06 06:05:22 -04:00

60 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 02:08:55 -0500
Subject: [PATCH] Make /plugins list alphabetical
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
index bcb576a4271b1ec7b1cfe6f83cf161b7d89ed2e5..a1071e3178a298f3fc1d6c960f4d8a6d3a3d0277 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -3,6 +3,9 @@ package org.bukkit.command.defaults;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -34,23 +37,32 @@ public class PluginsCommand extends BukkitCommand {
@NotNull
private String getPluginList() {
- StringBuilder pluginList = new StringBuilder();
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
+ // Paper start
+ TreeMap<String, Plugin> plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+
+ 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) {
pluginList.append(ChatColor.WHITE);
pluginList.append(", ");
}
- pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
- pluginList.append(plugin.getDescription().getName());
+ Plugin plugin = entry.getValue();
if (plugin.getDescription().getProvides().size() > 0) {
pluginList.append(" (").append(String.join(", ", plugin.getDescription().getProvides())).append(")");
}
+
+
+ pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
+ pluginList.append(plugin.getDescription().getName());
}
- return "(" + plugins.length + "): " + pluginList.toString();
+ return "(" + plugins.size() + "): " + pluginList.toString();
+ // Paper end
}
}