aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/config/ConfigIO.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/config/ConfigIO.java')
-rw-r--r--src/main/java/config/ConfigIO.java49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/config/ConfigIO.java b/src/main/java/config/ConfigIO.java
deleted file mode 100644
index 4898c9b58d..0000000000
--- a/src/main/java/config/ConfigIO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package config;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-public class ConfigIO {
-
- private static final String CONFIG_PATH = "main/java/config/config.properties";
- private static final int CONFIG_SIZE = 0;
-
- private static Properties config;
-
- private ConfigIO() {
-
- }
-
- public static void load() {
- config = new Properties();
- try {
- config.load(new FileInputStream(CONFIG_PATH));
- } catch (IOException e) {
- throw new IllegalStateException("Failed to load KekzTech config!");
- }
- if(config.size() != CONFIG_SIZE) {
- throw new IllegalStateException("KekzTech config is not expected size!");
- }
- }
-
- @SuppressWarnings("unchecked")
- public <T> T get(String key, T valueType) {
- if(config.size() != CONFIG_SIZE) {
- throw new IllegalStateException("Tried to access config without loading it first");
- }
- return (T) config.get((Object) key);
- }
-
- public static void saveConfig() {
- try {
- config = (config == null) ? new Properties() : config;
- config.setProperty("key", "value");
- config.store(new FileOutputStream(CONFIG_PATH), "Welcome to KekzTech's config file :)");
- } catch (IOException e) {
- System.err.println("Failed to save changes to KekzTech config. Settings may be lost.");
- }
- }
-
-}