use of org.spongepowered.server.launch.LaunchException in project SpongeVanilla by SpongePowered.
the class MetadataContainer method load.
public static MetadataContainer load(String path) {
List<PluginMetadata> meta;
path = path + '/' + McModInfo.STANDARD_FILENAME;
try (InputStream in = MetadataContainer.class.getResourceAsStream(path)) {
if (in == null) {
if (VanillaLaunch.ENVIRONMENT != DEVELOPMENT) {
throw new LaunchException("Unable to find metadata file at " + path);
}
return new MetadataContainer(ImmutableMap.of());
}
meta = McModInfo.DEFAULT.read(in);
} catch (IOException e) {
throw new LaunchException("Failed to load metadata", e);
}
ImmutableMap.Builder<String, PluginMetadata> builder = ImmutableMap.builder();
for (PluginMetadata m : meta) {
builder.put(m.getId(), m);
}
return new MetadataContainer(builder.build());
}
Aggregations