use of org.spongepowered.plugin.meta.PluginDependency in project LanternServer by LanternPowered.
the class PluginCandidate method collectOptionalDependencies.
private void collectOptionalDependencies(@Nullable Iterable<PluginDependency> dependencies, Map<String, PluginContainer> loadedPlugins, Map<String, PluginCandidate> candidates) {
if (dependencies == null) {
return;
}
for (PluginDependency dependency : dependencies) {
final String id = dependency.getId();
if (this.id.equals(id)) {
Lantern.getLogger().error("Plugin '{}' from {} cannot have a dependency on itself. This is redundant and should be " + "removed.", this.id, getDisplaySource());
this.invalid = true;
continue;
}
final String version = dependency.getVersion();
final PluginContainer loaded = loadedPlugins.get(id);
if (loaded != null) {
if (!verifyVersionRange(id, version, loaded.getVersion().orElse(null))) {
this.missingRequirements.put(id, version);
}
continue;
}
final PluginCandidate candidate = candidates.get(id);
if (candidate != null) {
if (verifyVersionRange(id, version, candidate.getMetadata().getVersion())) {
this.dependencies.add(candidate);
} else {
this.missingRequirements.put(id, version);
}
}
}
}
Aggregations