diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-04-29 01:07:18 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-04-29 01:07:18 -0400 |
commit | b07e3799b34616885a90586a0fa5291a75ecbbc5 (patch) | |
tree | f91644b9133899af7e716909b0aca612d74b1ccb /src/main/java/me/Danker/handlers/ConfigHandler.java | |
parent | 01822bff56d23b98885227943bd1e042e4f9e946 (diff) | |
download | SkyblockMod-b07e3799b34616885a90586a0fa5291a75ecbbc5.tar.gz SkyblockMod-b07e3799b34616885a90586a0fa5291a75ecbbc5.tar.bz2 SkyblockMod-b07e3799b34616885a90586a0fa5291a75ecbbc5.zip |
Reduce mod init time by 70%
Diffstat (limited to 'src/main/java/me/Danker/handlers/ConfigHandler.java')
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index a200b01..810def2 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -32,9 +32,7 @@ public class ConfigHandler { } public static int getInt(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, 0).getInt(); } @@ -47,9 +45,7 @@ public class ConfigHandler { } public static double getDouble(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, 0D).getDouble(); } @@ -62,9 +58,7 @@ public class ConfigHandler { } public static String getString(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, "").getString(); } @@ -77,9 +71,7 @@ public class ConfigHandler { } public static boolean getBoolean(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, false).getBoolean(); } @@ -92,9 +84,7 @@ public class ConfigHandler { } public static void writeIntConfig(String category, String key, int value) { - config = new Configuration(new File(file)); try { - config.load(); int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -116,9 +106,7 @@ public class ConfigHandler { } public static void writeStringConfig(String category, String key, String value) { - config = new Configuration(new File(file)); try { - config.load(); String set = config.get(category, key, value).getString(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -140,9 +128,7 @@ public class ConfigHandler { } public static boolean hasKey(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (!config.hasCategory(category)) return false; return config.getCategory(category).containsKey(key); } catch (Exception ex) { @@ -154,9 +140,7 @@ public class ConfigHandler { } public static void deleteCategory(String category) { - config = new Configuration(new File(file)); try { - config.load(); if (config.hasCategory(category)) { config.removeCategory(new ConfigCategory(category)); } |