mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Actually list all missing hard depends (#5701)
This commit is contained in:
parent
e28342f959
commit
1cf0417000
1 changed files with 61 additions and 1 deletions
|
@ -4,6 +4,66 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -0,0 +0,0 @@ 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();
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
|
@ -23,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
+ // 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue