Inline logging in Config.java

This commit is contained in:
Len 2025-06-29 08:28:07 +02:00
parent 06a8aa0f65
commit 91e6d3be8e

View File

@ -34,7 +34,7 @@ public class Config {
config.load(CONFIG_FILE); config.load(CONFIG_FILE);
} catch (IOException ignore) { } catch (IOException ignore) {
} catch (InvalidConfigurationException ex) { } catch (InvalidConfigurationException ex) {
EssentiaPlugin.instance().getLogger().log(Level.SEVERE, "Could not load config.yml, please correct your syntax errors", ex); log(Level.SEVERE, "Could not load config.yml, please correct your syntax errors", ex);
Throwables.throwIfUnchecked(ex); Throwables.throwIfUnchecked(ex);
} }
config.options().header(HEADER); config.options().header(HEADER);
@ -43,7 +43,7 @@ public class Config {
version = getInt("config-version", 1); version = getInt("config-version", 1);
set("config-version", 1); set("config-version", 1);
EssentiaPlugin.instance().getLogger().info("Essentia Configuration loaded!"); log(Level.INFO,"Essentia Configuration loaded!");
readConfig(Config.class, null); readConfig(Config.class, null);
} }
@ -57,7 +57,7 @@ public class Config {
} catch (InvocationTargetException ex) { } catch (InvocationTargetException ex) {
Throwables.throwIfUnchecked(ex); Throwables.throwIfUnchecked(ex);
} catch (Exception ex) { } catch (Exception ex) {
EssentiaPlugin.instance().getLogger().log(Level.SEVERE, "Error invoking " + method, ex); log(Level.SEVERE, "Error invoking " + method, ex);
} }
} }
} }
@ -69,7 +69,7 @@ public class Config {
try { try {
config.save(CONFIG_FILE); config.save(CONFIG_FILE);
} catch (IOException ex) { } catch (IOException ex) {
EssentiaPlugin.instance().getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex); log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
} }
} }
@ -107,6 +107,10 @@ public class Config {
EssentiaPlugin.instance().getLogger().log(level, s); EssentiaPlugin.instance().getLogger().log(level, s);
} }
protected static void log(Level level, String s, Throwable thrown) {
EssentiaPlugin.instance().getLogger().log(level, s, thrown);
}
public static int TELEPORT_REQUEST_TIMEOUT = 30; public static int TELEPORT_REQUEST_TIMEOUT = 30;
public static boolean TELEPORT_REQUEST_TIMEOUT_MESSAGES = true; public static boolean TELEPORT_REQUEST_TIMEOUT_MESSAGES = true;
public static boolean BACK_ON_DEATH = false; public static boolean BACK_ON_DEATH = false;