Fix modproperties property in mods.toml causing exception (#7192)
This commit is contained in:
parent
5a20705f05
commit
07ffc890e5
2 changed files with 8 additions and 3 deletions
|
@ -70,8 +70,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
|||
this.license = config.<String>getConfigElement("license")
|
||||
.orElseThrow(()->new InvalidModFileException("Missing License, please supply a license.", this));
|
||||
this.showAsResourcePack = config.<Boolean>getConfigElement("showAsResourcePack").orElse(false);
|
||||
this.properties = config.<UnmodifiableConfig>getConfigElement("properties").
|
||||
map(UnmodifiableConfig::valueMap).orElse(Collections.emptyMap());
|
||||
this.properties = config.<Map<String, Object>>getConfigElement("properties").orElse(Collections.emptyMap());
|
||||
this.modFile.setFileProperties(this.properties);
|
||||
this.issueURL = config.<String>getConfigElement("issueTrackerURL").map(StringUtils::toURL).orElse(null);
|
||||
final List<? extends IConfigurable> modConfigs = config.getConfigList("mods");
|
||||
|
|
|
@ -45,8 +45,14 @@ public class NightConfigWrapper implements IConfigurable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
return this.config.getOptional(asList(key));
|
||||
return this.config.getOptional(asList(key)).map(value -> {
|
||||
if (value instanceof UnmodifiableConfig) {
|
||||
return (T) ((UnmodifiableConfig) value).valueMap();
|
||||
}
|
||||
return (T) value;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue