geforkt von Mirrors/Paper
[Bleeding] Added loadbefore property; Addresses BUKKIT-843
By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
Ursprung
791dd4c428
Commit
8874c4e872
@ -25,6 +25,7 @@ public final class PluginDescriptionFile {
|
||||
private String classLoaderOf = null;
|
||||
private List<String> depend = null;
|
||||
private List<String> softDepend = null;
|
||||
private List<String> loadBefore = null;
|
||||
private String version = null;
|
||||
private Map<String, Map<String, Object>> commands = null;
|
||||
private String description = null;
|
||||
@ -121,6 +122,14 @@ public final class PluginDescriptionFile {
|
||||
return softDepend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of plugins that should consider this plugin a soft-dependency
|
||||
* @return immutable list of plugins that should consider this plugin a soft-dependency
|
||||
*/
|
||||
public List<String> getLoadBefore() {
|
||||
return softDepend;
|
||||
}
|
||||
|
||||
public PluginLoadOrder getLoad() {
|
||||
return order;
|
||||
}
|
||||
@ -267,6 +276,20 @@ public final class PluginDescriptionFile {
|
||||
softDepend = softDependBuilder.build();
|
||||
}
|
||||
|
||||
if (map.get("loadbefore") != null) {
|
||||
ImmutableList.Builder<String> loadBeforeBuilder = ImmutableList.<String>builder();
|
||||
try {
|
||||
for (Object predependency : (Iterable<?>) map.get("loadbefore")) {
|
||||
loadBeforeBuilder.add(predependency.toString());
|
||||
}
|
||||
} catch (ClassCastException ex) {
|
||||
throw new InvalidDescriptionException(ex, "loadbefore is of wrong type");
|
||||
} catch (NullPointerException ex) {
|
||||
throw new InvalidDescriptionException(ex, "invalid load-before format");
|
||||
}
|
||||
loadBefore = loadBeforeBuilder.build();
|
||||
}
|
||||
|
||||
if (map.get("database") != null) {
|
||||
try {
|
||||
database = (Boolean) map.get("database");
|
||||
|
@ -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();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren