mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
1143b63663
* Add Position * move Position patch to start
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 c67d2e96e30261e480f1df96464befac03d78a69..81da1def96d18704303cadd72261a1b2fcbb9fc5 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -102,5 +102,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 032ed2aba7d47144d241d616ba27489ce22d6fea..e98934d32b8dac88b3c3fd14ea5d726872212807 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 {
|
|
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;
|
|
|