From 607c463ca170254672f70fd10b81157db6b8b114 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 a4aabfe7f..f462b631b 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -67,4 +67,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 d4e74d292..6cfd9f3c6 100644 --- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java +++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java @@ -41,7 +41,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 095448fe7..e91cb2c78 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -312,7 +312,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.21.0