if (logNormal())
info("Loading variables...");
final long vls = System.currentTimeMillis();
final LogHandler h = SkriptLogger.startLogHandler(new ErrorDescLogHandler() {
private final List<LogEntry> log = new ArrayList<LogEntry>();
@Override
public LogResult log(final LogEntry entry) {
super.log(entry);
if (entry.level.intValue() >= Level.SEVERE.intValue()) {
logEx(entry.message); // no [Skript] prefix
return LogResult.DONT_LOG;
} else {
log.add(entry);
return LogResult.CACHED;
}
}
@Override
protected void beforeErrors() {
logEx();
logEx("===!!!=== Skript variable load error ===!!!===");
logEx("Unable to load (all) variables:");
}
@Override
protected void afterErrors() {
logEx();
logEx("Skript will work properly, but old variables might not be available at all and new ones may or may not be saved until Skript is able to create a backup of the old file and/or is able to connect to the database (which requires a restart of Skript)!");
logEx();
}
@Override
protected void onStop() {
super.onStop();
SkriptLogger.logAll(log);
}
});
final CountingLogHandler c = SkriptLogger.startLogHandler(new CountingLogHandler(SkriptLogger.SEVERE));
try {
if (!Variables.load())
if (c.getCount() == 0)
error("(no information available)");
} finally {
c.stop();
h.stop();
}
final long vld = System.currentTimeMillis() - vls;
if (logNormal())
info("Loaded " + Variables.numVariables() + " variables in " + ((vld / 100) / 10.) + " seconds");