Fix LegacyPluginLoader dependency registration (#9165)

This commit is contained in:
Owen 2023-04-22 21:55:10 -04:00 committed by GitHub
parent 8e3009e0db
commit 5c4671a9bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1762,10 +1762,10 @@ index 0000000000000000000000000000000000000000..a2fa8406bc3f0dcab6805633ae984d03
+}
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/MetaDependencyTree.java b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/MetaDependencyTree.java
new file mode 100644
index 0000000000000000000000000000000000000000..1523cbb1801b937c3d40080df7d52e6cff8fc49c
index 0000000000000000000000000000000000000000..e72bec3b0cbc41580f1b4beecae316d1c083d3e3
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/MetaDependencyTree.java
@@ -0,0 +1,112 @@
@@ -0,0 +1,117 @@
+package io.papermc.paper.plugin.entrypoint.dependency;
+
+import com.google.common.graph.GraphBuilder;
@ -1867,6 +1867,11 @@ index 0000000000000000000000000000000000000000..1523cbb1801b937c3d40080df7d52e6c
+ return this.dependencies.contains(pluginIdentifier);
+ }
+
+ // Used by the legacy loader -- this isn't recommended
+ public void addDirectDependency(String dependency) {
+ this.dependencies.add(dependency);
+ }
+
+ @Override
+ public String toString() {
+ return "ProviderDependencyTree{" +
@ -2240,10 +2245,10 @@ index 0000000000000000000000000000000000000000..a9bca905eba67972e4d1b07b1d243272
+}
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/LegacyPluginLoadingStrategy.java b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/LegacyPluginLoadingStrategy.java
new file mode 100644
index 0000000000000000000000000000000000000000..ebd193e7d9736021756223d565c8a16a7b1770d2
index 0000000000000000000000000000000000000000..f59f48654eaa299bcac862991b1e2e622264639b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/strategy/LegacyPluginLoadingStrategy.java
@@ -0,0 +1,269 @@
@@ -0,0 +1,271 @@
+package io.papermc.paper.plugin.entrypoint.strategy;
+
+import com.google.common.graph.GraphBuilder;
@ -2292,6 +2297,7 @@ index 0000000000000000000000000000000000000000..ebd193e7d9736021756223d565c8a16a
+ PluginMeta configuration = provider.getMeta();
+
+ PluginProvider<T> replacedProvider = providersToLoad.put(configuration.getName(), provider);
+ dependencyTree.addDirectDependency(configuration.getName()); // add to dependency tree
+ if (replacedProvider != null) {
+ LOGGER.severe(String.format(
+ "Ambiguous plugin name `%s' for files `%s' and `%s' in `%s'",
@ -2324,6 +2330,7 @@ index 0000000000000000000000000000000000000000..ebd193e7d9736021756223d565c8a16a
+ ));
+ } else {
+ String replacedPlugin = pluginsProvided.put(provided, configuration.getName());
+ dependencyTree.addDirectDependency(provided); // add to dependency tree
+ if (replacedPlugin != null) {
+ LOGGER.warning(String.format(
+ "`%s' is provided by both `%s' and `%s'",