Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
67 Zeilen
3.3 KiB
Diff
67 Zeilen
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 195b6bb328de92c4d17d1cd14e13578226b1ac3c..d6897f43a0692e031bed8a212d9a637ef548cc60 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -91,5 +91,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 816c2b1797447ab315ceb6eda89d25f27d2bce98..f26303315c9c93356f0b04440136855dd54d32b7 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;
|
|
|