From 613db95e016a659cc36f3889073345bd892ad8b9 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 19 Jul 2018 15:08:07 -0500 Subject: [PATCH] Add an asterisk to plugins onEnable and in command Easy visual indicator for server admins to tell which plugins are operating under the legacy compat mode, and which have been updated. --- ...dd-an-asterisk-to-legacy-API-plugins.patch | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Spigot-API-Patches/0123-Add-an-asterisk-to-legacy-API-plugins.patch diff --git a/Spigot-API-Patches/0123-Add-an-asterisk-to-legacy-API-plugins.patch b/Spigot-API-Patches/0123-Add-an-asterisk-to-legacy-API-plugins.patch new file mode 100644 index 0000000000..0403a37fbc --- /dev/null +++ b/Spigot-API-Patches/0123-Add-an-asterisk-to-legacy-API-plugins.patch @@ -0,0 +1,66 @@ +From a91f4cbb8c66889302966caa04d7fbbd3ad265cc Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Thu, 19 Jul 2018 15:07:02 -0500 +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 20b3a9ee..c4083b4f 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -64,4 +64,10 @@ public interface UnsafeValues { + * @return true if a file matching this key was found and deleted + */ + boolean removeAdvancement(NamespacedKey key); ++ ++ // Paper start - Add legacy check util ++ static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) { ++ return !("1.13".equals(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 b1d384e8..72c0c0bc 100644 +--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java ++++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java +@@ -38,7 +38,14 @@ public class PluginsCommand extends BukkitCommand { + TreeMap plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + + for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { +- plugins.put(plugin.getDescription().getName(), plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED); ++ // Paper start - Add an asterisk to legacy plugins (so admins are aware) ++ String pluginName = plugin.getDescription().getName(); ++ if (org.bukkit.UnsafeValues.isLegacyPlugin(plugin)) { ++ pluginName += "*"; ++ } ++ ++ plugins.put(pluginName, plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED); ++ // Paper end + } + + StringBuilder pluginList = new StringBuilder(); +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 3cff01b6..2b9aad0a 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -303,7 +303,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; + +-- +2.17.1 +