66 lines
3.3 KiB
Diff
66 lines
3.3 KiB
Diff
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 5183d3b1893fdcad9a475b747cb34df5653774fd..4af059f9b32d2a0913e6d88c6a93e101018e88a2 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -111,5 +111,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 e0423adf45bf5855c23259257863f67cec1c3d54..c0b9ed3a1e28c51d0195c53ec3d301dcdf58046f 100644
|
|
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
@@ -308,7 +308,14 @@ public final class JavaPluginLoader implements PluginLoader {
|
|
Preconditions.checkArgument(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;
|
|
|