List all missing hard depends not just first (#5673)

This commit is contained in:
Jake Potrebic 2021-05-20 22:33:41 -07:00 committed by GitHub
parent aed5031e31
commit dab6ec6cdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index d3812d8cd195017841ee08ffbc53a5748fcc74ec..c2070d2df2349f6215250f0d24319befafbcf472 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 {
));
}
+ Set<String> missingHardDependencies = new HashSet<>(description.getDepend().size()); // Paper - list all missing hard depends
for (final String pluginName : description.getDepend()) {
Plugin current = server.getPluginManager().getPlugin(pluginName);
if (current == null) {
- throw new UnknownDependencyException("Unknown dependency " + pluginName + ". Please download and install " + pluginName + " to run this plugin.");
+ missingHardDependencies.add(pluginName); // Paper - list all missing hard depends
}
}
+ // 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.");
+ }
+ // Paper end
server.getUnsafe().checkSupported(description);