diff options
author | Jason <[email protected]> | 2021-05-21 13:31:37 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-21 16:31:37 -0400 |
commit | f3e541ca1be95f48a82ccf09a1f843edba4deddb (patch) | |
tree | d0640d75862337307c9ba6171b5c2ed0f67ef632 | |
parent | 11f83fe8e0b66377305be3ed6ce2e93c055cd965 (diff) | |
download | Paper-f3e541ca1be95f48a82ccf09a1f843edba4deddb.tar.gz Paper-f3e541ca1be95f48a82ccf09a1f843edba4deddb.zip |
Actually list all missing hard depends (#5701)
-rw-r--r-- | Spigot-API-Patches/0305-List-all-missing-hard-depends-not-just-first.patch | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/Spigot-API-Patches/0305-List-all-missing-hard-depends-not-just-first.patch b/Spigot-API-Patches/0305-List-all-missing-hard-depends-not-just-first.patch index 85cf5bd18a..bbbab43d60 100644 --- a/Spigot-API-Patches/0305-List-all-missing-hard-depends-not-just-first.patch +++ b/Spigot-API-Patches/0305-List-all-missing-hard-depends-not-just-first.patch @@ -4,8 +4,68 @@ Date: Tue, 18 May 2021 10:38:10 -0700 Subject: [PATCH] List all missing hard depends not just first +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index ca866876f2f35a1c41eb009064412423fa09e441..d1c35e4cf778070f8d18bbe0af8d423334c6dfbf 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -264,6 +264,7 @@ public final class SimplePluginManager implements PluginManager { + + if (dependencies.containsKey(plugin)) { + Iterator<String> dependencyIterator = dependencies.get(plugin).iterator(); ++ final Set<String> missingHardDependencies = new HashSet<>(dependencies.get(plugin).size()); // Paper - list all missing hard depends + + while (dependencyIterator.hasNext()) { + String dependency = dependencyIterator.next(); +@@ -274,6 +275,12 @@ public final class SimplePluginManager implements PluginManager { + + // We have a dependency not found + } else if (!plugins.containsKey(dependency) && !pluginsProvided.containsKey(dependency)) { ++ // Paper start ++ missingHardDependencies.add(dependency); ++ } ++ } ++ if (!missingHardDependencies.isEmpty()) { ++ // Paper end + missingDependency = false; + pluginIterator.remove(); + softDependencies.remove(plugin); +@@ -282,9 +289,7 @@ public final class SimplePluginManager implements PluginManager { + server.getLogger().log( + Level.SEVERE, + "Could not load '" + entry.getValue().getPath() + "' in folder '" + entry.getValue().getParentFile().getPath() + "'", // Paper +- new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin.")); +- break; +- } ++ new UnknownDependencyException(missingHardDependencies, plugin)); // Paper + } + + if (dependencies.containsKey(plugin) && dependencies.get(plugin).isEmpty()) { +diff --git a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java +index a80251eff75430863b37db1c131e22593f3fcd5e..7b2e607a21f1173d98ee84581881411176380625 100644 +--- a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java ++++ b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java +@@ -26,6 +26,19 @@ public class UnknownDependencyException extends RuntimeException { + super(message); + } + ++ // Paper start ++ /** ++ * Create a new {@link UnknownDependencyException} with a message informing ++ * about which dependencies are missing for what plugin. ++ * ++ * @param missingDependencies missing dependencies ++ * @param pluginName plugin which is missing said dependencies ++ */ ++ public UnknownDependencyException(final @org.jetbrains.annotations.NotNull java.util.Collection<String> missingDependencies, final @org.jetbrains.annotations.NotNull String pluginName) { ++ this("Unknown/missing dependency plugins: [" + String.join(", ", missingDependencies) + "]. Please download and install these plugins to run '" + pluginName + "'."); ++ } ++ // Paper end ++ + /** + * Constructs a new UnknownDependencyException based on the given + * Exception diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index d3812d8cd195017841ee08ffbc53a5748fcc74ec..c2070d2df2349f6215250f0d24319befafbcf472 100644 +index d3812d8cd195017841ee08ffbc53a5748fcc74ec..b622cedeeee017f042bcf92485d81832030a8030 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -132,13 +132,19 @@ public final class JavaPluginLoader implements PluginLoader { @@ -23,7 +83,7 @@ index d3812d8cd195017841ee08ffbc53a5748fcc74ec..c2070d2df2349f6215250f0d24319bef } + // Paper start - list all missing hard depends + if (!missingHardDependencies.isEmpty()) { -+ throw new UnknownDependencyException("Unknown dependencies: " + String.join(", ", missingHardDependencies) + " Please download and install these plugins to run this plugin."); ++ throw new UnknownDependencyException(missingHardDependencies, description.getFullName()); + } + // Paper end |