aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0123-Add-an-asterisk-to-legacy-API-plugins.patch
blob: 5c3bfe82c96b3d2eeae2c7fb521652d3cf982b25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <max@themoep.de>
Date: Tue, 1 Dec 2020 14:57:02 +0100
Subject: [PATCH] Add an asterisk to legacy API plugins

Not here to name and shame, only so server admins can be aware of which
plugins have and haven't been updated.

diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index bfeec56e83229dbfc8625b3b90bd6c138c73bc1d..9341c7fbf619a42ed5329136b7fb4f52fb81a922 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -92,5 +92,11 @@ public interface UnsafeValues {
     default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
         return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
     }
+
+    boolean isSupportedApiVersion(String apiVersion);
+
+    static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
+        return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
+    }
     // Paper end
 }
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
index 4de959bbd1270d7d6ea8e5e69521bcca6abe2138..1aa58c59e1e8738bbdc77752885ff3b18b29de42 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -52,9 +52,15 @@ public class PluginsCommand extends BukkitCommand {
             }
 
             Plugin plugin = entry.getValue();
-            
+
             pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
-            pluginList.append(plugin.getDescription().getName());
+            // Paper start - Add an asterisk to legacy plugins (so admins are aware)
+            String pluginName = plugin.getDescription().getName();
+            if (org.bukkit.UnsafeValues.isLegacyPlugin(plugin)) {
+                pluginName += "*";
+            }
+            pluginList.append(pluginName);
+            // Paper end
 
             if (plugin.getDescription().getProvides().size() > 0) {
                 pluginList.append(" (").append(String.join(", ", plugin.getDescription().getProvides())).append(")");
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 47b306929654855944b1e95f81c641dea6102096..922bb2cbfaf1e4cd111b7ad286c867c4d9f47e05 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -306,7 +306,14 @@ public final class JavaPluginLoader implements PluginLoader {
         Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
 
         if (!plugin.isEnabled()) {
-            plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName());
+            // Paper start - Add an asterisk to legacy plugins (so admins are aware)
+            String enableMsg = "Enabling " + plugin.getDescription().getFullName();
+            if (org.bukkit.UnsafeValues.isLegacyPlugin(plugin)) {
+                enableMsg += "*";
+            }
+
+            plugin.getLogger().info(enableMsg);
+            // Paper end
 
             JavaPlugin jPlugin = (JavaPlugin) plugin;