Paper/Spigot-API-Patches/0119-Add-an-asterisk-to-legacy-API-plugins.patch
Aikar e4d10a6d67
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches
a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType()

CraftBukkit Changes:
bbe3d58e SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException
3075579f Add FaceAttachable interface to handle Grindstone facing in common with Switches
95bd4238 SPIGOT-5647: ZombieVillager entity should have getVillagerType()
4d975ac3 SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
2020-04-02 17:09:17 -04:00

67 lines
3 KiB
Diff

From 859aa7959514bd7c7c6156727967c3382bb6573e Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 19 Jul 2018 22:07:02 +0200
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 c0ff133de..821064264 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -83,5 +83,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 a1071e317..3dcecf3a5 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -59,7 +59,13 @@ public class PluginsCommand extends BukkitCommand {
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
}
return "(" + plugins.size() + "): " + pluginList.toString();
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 32ec68b48..8ff228ced 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -315,7 +315,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.25.1