From 7db75ab21b41b13cfe8b0f7b5448725db6291c99 Mon Sep 17 00:00:00 2001 From: dfsek Date: Fri, 4 Dec 2020 21:34:48 -0700 Subject: [PATCH] Fix minor loading issue --- .../java/com/dfsek/terra/config/base/ConfigPack.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/dfsek/terra/config/base/ConfigPack.java b/src/main/java/com/dfsek/terra/config/base/ConfigPack.java index 0540da123..3f8141d43 100644 --- a/src/main/java/com/dfsek/terra/config/base/ConfigPack.java +++ b/src/main/java/com/dfsek/terra/config/base/ConfigPack.java @@ -114,9 +114,7 @@ public class ConfigPack { throw new FileMissingException("No pack.yml file found in " + folder.getAbsolutePath(), e); } - load(new FolderLoader(folder.toPath())); - - LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - l) / 1000000D), template.getAuthor(), template.getVersion()); + load(new FolderLoader(folder.toPath()), l); } public ConfigPack(ZipFile file) throws ConfigException { @@ -137,11 +135,10 @@ public class ConfigPack { selfLoader.load(template, stream); - load(new ZIPLoader(file)); - LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - l) / 1000000D)); + load(new ZIPLoader(file), l); } - private void load(Loader loader) throws ConfigException { + private void load(Loader loader, long start) throws ConfigException { for(Map.Entry var : template.getVariables().entrySet()) { 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)))); + + LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - start) / 1000000D), template.getAuthor(), template.getVersion()); } private void buildAll(TerraFactory factory, TerraRegistry registry, List configTemplates) throws LoadException {