[Bleeding] Added loadbefore property; Addresses BUKKIT-843

By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
Bukkit/Spigot
2012-03-20 03:54:51 -05:00
parent 791dd4c428
commit 8874c4e872
2 changed files with 43 additions and 2 deletions

View File

@ -139,13 +139,32 @@ public final class SimplePluginManager implements PluginManager {
Collection<String> softDependencySet = description.getSoftDepend();
if (softDependencySet != null) {
softDependencies.put(description.getName(), new LinkedList<String>(softDependencySet));
if (softDependencies.containsKey(description.getName())) {
// Duplicates do not matter, they will be removed together if applicable
softDependencies.get(description.getName()).addAll(softDependencySet);
} else {
softDependencies.put(description.getName(), new LinkedList<String>(softDependencySet));
}
}
Collection<String> dependencySet = description.getDepend();
if (dependencySet != null) {
dependencies.put(description.getName(), new LinkedList<String>(dependencySet));
}
Collection<String> loadBeforeSet = description.getLoadBefore();
if (loadBeforeSet != null) {
for (String loadBeforeTarget : loadBeforeSet) {
if (softDependencies.containsKey(loadBeforeTarget)) {
softDependencies.get(loadBeforeTarget).add(description.getName());
} else {
// softDependencies is never iterated, so 'ghost' plugins aren't an issue
Collection<String> shortSoftDependency = new LinkedList<String>();
shortSoftDependency.add(description.getName());
softDependencies.put(loadBeforeTarget, shortSoftDependency);
}
}
}
}
while (!plugins.isEmpty()) {
@ -227,7 +246,6 @@ public final class SimplePluginManager implements PluginManager {
if (!dependencies.containsKey(plugin)) {
softDependencies.remove(plugin);
dependencies.remove(plugin);
missingDependency = false;
File file = plugins.get(plugin);
pluginIterator.remove();