Fix minor loading issue

This commit is contained in:
dfsek
2020-12-04 21:34:48 -07:00
parent 3d12af6b21
commit 7db75ab21b
@@ -114,9 +114,7 @@ public class ConfigPack {
throw new FileMissingException("No pack.yml file found in " + folder.getAbsolutePath(), e); throw new FileMissingException("No pack.yml file found in " + folder.getAbsolutePath(), e);
} }
load(new FolderLoader(folder.toPath())); load(new FolderLoader(folder.toPath()), l);
LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - l) / 1000000D), template.getAuthor(), template.getVersion());
} }
public ConfigPack(ZipFile file) throws ConfigException { public ConfigPack(ZipFile file) throws ConfigException {
@@ -137,11 +135,10 @@ public class ConfigPack {
selfLoader.load(template, stream); selfLoader.load(template, stream);
load(new ZIPLoader(file)); load(new ZIPLoader(file), l);
LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - l) / 1000000D));
} }
private void load(Loader loader) throws ConfigException { private void load(Loader loader, long start) throws ConfigException {
for(Map.Entry<String, Double> var : template.getVariables().entrySet()) { for(Map.Entry<String, Double> var : template.getVariables().entrySet()) {
varScope.create(var.getKey()).setValue(var.getValue()); varScope.create(var.getKey()).setValue(var.getValue());
} }
@@ -164,6 +161,8 @@ public class ConfigPack {
} }
} }
template.getStructureLocatables().forEach((type, name) -> structureMap.put(Objects.requireNonNull(type), Objects.requireNonNull(structureRegistry.get(name)))); template.getStructureLocatables().forEach((type, name) -> structureMap.put(Objects.requireNonNull(type), Objects.requireNonNull(structureRegistry.get(name))));
LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - start) / 1000000D), template.getAuthor(), template.getVersion());
} }
private <C extends AbstractableTemplate, O> void buildAll(TerraFactory<C, O> factory, TerraRegistry<O> registry, List<C> configTemplates) throws LoadException { private <C extends AbstractableTemplate, O> void buildAll(TerraFactory<C, O> factory, TerraRegistry<O> registry, List<C> configTemplates) throws LoadException {