mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 06:40:55 +00:00
improve logging
This commit is contained in:
@@ -104,6 +104,7 @@ public class ConfigPack implements LoaderRegistrar {
|
|||||||
|
|
||||||
|
|
||||||
public ConfigPack(File folder, TerraPlugin main) throws ConfigException {
|
public ConfigPack(File folder, TerraPlugin main) throws ConfigException {
|
||||||
|
try {
|
||||||
this.loader = new FolderLoader(folder.toPath());
|
this.loader = new FolderLoader(folder.toPath());
|
||||||
this.main = main;
|
this.main = main;
|
||||||
long l = System.nanoTime();
|
long l = System.nanoTime();
|
||||||
@@ -121,6 +122,9 @@ public class ConfigPack implements LoaderRegistrar {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
selfLoader.load(template, new FileInputStream(pack));
|
selfLoader.load(template, new FileInputStream(pack));
|
||||||
|
|
||||||
|
main.getLogger().info("Loading config pack \"" + template.getID() + "\"");
|
||||||
|
|
||||||
load(l, main);
|
load(l, main);
|
||||||
ConfigPackPostTemplate packPostTemplate = new ConfigPackPostTemplate();
|
ConfigPackPostTemplate packPostTemplate = new ConfigPackPostTemplate();
|
||||||
selfLoader.load(packPostTemplate, new FileInputStream(pack));
|
selfLoader.load(packPostTemplate, new FileInputStream(pack));
|
||||||
@@ -129,9 +133,14 @@ public class ConfigPack implements LoaderRegistrar {
|
|||||||
} catch(FileNotFoundException e) {
|
} catch(FileNotFoundException e) {
|
||||||
throw new FileMissingException("No pack.yml file found in " + folder.getAbsolutePath(), e);
|
throw new FileMissingException("No pack.yml file found in " + folder.getAbsolutePath(), e);
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
main.getLogger().severe("Failed to load config pack from folder \"" + folder.getAbsolutePath() + "\"");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigPack(ZipFile file, TerraPlugin main) throws ConfigException {
|
public ConfigPack(ZipFile file, TerraPlugin main) throws ConfigException {
|
||||||
|
try {
|
||||||
this.loader = new ZIPLoader(file);
|
this.loader = new ZIPLoader(file);
|
||||||
this.main = main;
|
this.main = main;
|
||||||
long l = System.nanoTime();
|
long l = System.nanoTime();
|
||||||
@@ -145,7 +154,6 @@ public class ConfigPack implements LoaderRegistrar {
|
|||||||
main.register(selfLoader);
|
main.register(selfLoader);
|
||||||
main.register(abstractConfigLoader);
|
main.register(abstractConfigLoader);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ZipEntry pack = null;
|
ZipEntry pack = null;
|
||||||
Enumeration<? extends ZipEntry> entries = file.entries();
|
Enumeration<? extends ZipEntry> entries = file.entries();
|
||||||
@@ -157,6 +165,7 @@ public class ConfigPack implements LoaderRegistrar {
|
|||||||
if(pack == null) throw new FileMissingException("No pack.yml file found in " + file.getName());
|
if(pack == null) throw new FileMissingException("No pack.yml file found in " + file.getName());
|
||||||
|
|
||||||
selfLoader.load(template, file.getInputStream(pack));
|
selfLoader.load(template, file.getInputStream(pack));
|
||||||
|
main.getLogger().info("Loading config pack \"" + template.getID() + "\"");
|
||||||
|
|
||||||
load(l, main);
|
load(l, main);
|
||||||
|
|
||||||
@@ -168,6 +177,10 @@ public class ConfigPack implements LoaderRegistrar {
|
|||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new LoadException("Unable to load pack.yml from ZIP file", e);
|
throw new LoadException("Unable to load pack.yml from ZIP file", e);
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
main.getLogger().severe("Failed to load config pack from ZIP archive \"" + file.getName() + "\"");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <C extends AbstractableTemplate, O> void buildAll(TerraFactory<C, O> factory, TerraRegistry<O> registry, List<C> configTemplates, TerraPlugin main) throws LoadException {
|
public static <C extends AbstractableTemplate, O> void buildAll(TerraFactory<C, O> factory, TerraRegistry<O> registry, List<C> configTemplates, TerraPlugin main) throws LoadException {
|
||||||
|
|||||||
Reference in New Issue
Block a user