Skip to content

Commit

Permalink
always output bukkit/paper plugin header in plugin command
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Jul 20, 2024
1 parent 032697e commit b2d1fea
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions patches/server/0277-Improve-output-of-plugins-command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Co-authored-by: Oharass <[email protected]>
Co-authored-by: granny <[email protected]>

diff --git a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b8729be33 100644
index f0fce4113fb07c64adbec029d177c236cbdcbae8..865dc183276720d54d31d2a54d1bb5c845e80598 100644
--- a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
+++ b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
@@ -78,10 +78,10 @@ public class PaperPluginsCommand extends BukkitCommand {
Expand All @@ -32,7 +32,7 @@ index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b
TextComponent.Builder builder = Component.text();
if (provider instanceof SpigotPluginProvider spigotPluginProvider && CraftMagicNumbers.isLegacy(spigotPluginProvider.getMeta())) {
builder.append(LEGACY_PLUGIN_STAR);
@@ -117,12 +117,64 @@ public class PaperPluginsCommand extends BukkitCommand {
@@ -117,13 +117,65 @@ public class PaperPluginsCommand extends BukkitCommand {

String name = provider.getMeta().getName();
Component pluginName = Component.text(name, fromStatus(provider))
Expand Down Expand Up @@ -71,13 +71,13 @@ index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b
+
+ pluginName.hoverEvent(hover.build());
+ }
+ // Purpur end

builder.append(pluginName);
+ // Purpur end
+
+ return builder.build();
+ }
+

return builder.build();
}

+ // Purpur start
+ @NotNull
+ private static TextComponent getAuthors(@NotNull final PluginMeta pluginMeta) {
Expand All @@ -91,13 +91,14 @@ index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b
+
+ builder.append(Component.text(authors.get(i), NamedTextColor.GREEN));
+ }
return builder.build();
}
+
+ return builder.build();
+ }
+ // Purpur end
+
private static Component asPlainComponents(String strings) {
net.kyori.adventure.text.TextComponent.Builder builder = Component.text();
for (String string : strings.split("\n")) {
@@ -182,24 +234,24 @@ public class PaperPluginsCommand extends BukkitCommand {
}
}
Expand All @@ -109,20 +110,24 @@ index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b
- sender.sendMessage(infoMessage);
+ //sender.sendMessage(infoMessage); // Purpur

if (!paperPlugins.isEmpty()) {
- if (!paperPlugins.isEmpty()) {
- sender.sendMessage(PAPER_HEADER);
- }
+ //if (!paperPlugins.isEmpty()) { // Purpur
+ sender.sendMessage(PAPER_HEADER.append(Component.text(" (%s):".formatted(paperPlugins.size())))); // Purpur
}
+ //} // Purpur

- for (Component component : formatProviders(paperPlugins)) {
+ for (Component component : formatProviders(paperPlugins, sender)) { // Purpur
sender.sendMessage(component);
}

if (!spigotPlugins.isEmpty()) {
- if (!spigotPlugins.isEmpty()) {
- sender.sendMessage(BUKKIT_HEADER);
- }
+ //if (!spigotPlugins.isEmpty()) { // Purpur
+ sender.sendMessage(BUKKIT_HEADER.append(Component.text(" (%s):".formatted(spigotPlugins.size())))); // Purpur
}
+ //} // Purpur

- for (Component component : formatProviders(spigotPlugins)) {
+ for (Component component : formatProviders(spigotPlugins, sender)) { // Purpur
Expand Down

0 comments on commit b2d1fea

Please sign in to comment.