Paper/Spigot-API-Patches/0119-Add-an-asterisk-to-legacy-API-plugins.patch
Spottedleaf 5c7081fecc Update upstream & fix some chunk related issues (#2177)
* 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:
45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories

CraftBukkit Changes:
4090d01f SPIGOT-5047: Correct slot types for 1.14 inventories
e8c08362 SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.
d445af3b SPIGOT-5067: Add item meta for 1.14 spawn eggs

* Bring Chunk load checks in-line with spigot

As of the last upstream merge spigot now checks ticket level status
when returning loaded chunks for a world from api. Now our checks
will respect that decision.

* Fix spawn ticket levels

Vanilla would keep the inner chunks of spawn available for ticking,
however my changes made all chunks non-ticking. Resolve by changing
ticket levels for spawn chunks inside the border to respect this
behavior.


* Make World#getChunkIfLoadedImmediately return only entity ticking chunks

Mojang appears to be using chunks with level > 33 (non-ticking chunks)
as cached chunks and not actually loaded chunks.

* Bring all loaded checks in line with spigot

Loaded chunks must be at least border  chunks, or level <= 33
2019-06-14 03:27:40 +01:00

66 lines
3.1 KiB
Diff

From 63b188a23ef7f524c393cd27697de441329502f5 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
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 c0ff133de..b173e2ece 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -83,5 +83,9 @@ public interface UnsafeValues {
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
}
+
+ static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
+ return !"1.13".equals(plugin.getDescription().getAPIVersion()) && !"1.14".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<String, ChatColor> 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 bc7bf6a35..31a70b294 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -316,7 +316,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