aboutsummaryrefslogtreecommitdiff
path: root/me/Danker/handlers
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-08-05 20:28:13 -0400
committerbowser0000 <bowser0000@gmail.com>2020-08-05 20:28:13 -0400
commitcd9303b0c510005f6162468beb26eb4ec397a757 (patch)
tree75cd784c1829139bdbfb2b5c63dd4bd2dd59f410 /me/Danker/handlers
parent92b0a7959090b56ab313f77143ffd07a1483ea71 (diff)
downloadSkyblockMod-cd9303b0c510005f6162468beb26eb4ec397a757.tar.gz
SkyblockMod-cd9303b0c510005f6162468beb26eb4ec397a757.tar.bz2
SkyblockMod-cd9303b0c510005f6162468beb26eb4ec397a757.zip
Add ability to reset trackers
With confirmation in case some person decides to randomly type /resetloot
Diffstat (limited to 'me/Danker/handlers')
-rw-r--r--me/Danker/handlers/ConfigHandler.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/me/Danker/handlers/ConfigHandler.java b/me/Danker/handlers/ConfigHandler.java
index 95aa3fe..9d7c110 100644
--- a/me/Danker/handlers/ConfigHandler.java
+++ b/me/Danker/handlers/ConfigHandler.java
@@ -8,6 +8,7 @@ import me.Danker.commands.MoveCommand;
import me.Danker.commands.ToggleCommand;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
public class ConfigHandler {
@@ -19,7 +20,7 @@ public class ConfigHandler {
try {
config.load();
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -33,7 +34,7 @@ public class ConfigHandler {
return config.get(category, key, 0).getInt();
}
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -63,7 +64,7 @@ public class ConfigHandler {
return config.get(category, key, "").getString();
}
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -78,7 +79,7 @@ public class ConfigHandler {
return config.get(category, key, false).getBoolean();
}
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -92,7 +93,7 @@ public class ConfigHandler {
int set = config.get(category, key, value).getInt();
config.getCategory(category).get(key).set(value);
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -118,7 +119,7 @@ public class ConfigHandler {
String set = config.get(category, key, value).getString();
config.getCategory(category).get(key).set(value);
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -131,7 +132,7 @@ public class ConfigHandler {
boolean set = config.get(category, key, value).getBoolean();
config.getCategory(category).get(key).set(value);
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
@@ -144,13 +145,27 @@ public class ConfigHandler {
if (!config.hasCategory(category)) return false;
return config.getCategory(category).containsKey(key);
} catch (Exception ex) {
- System.err.print(ex);
+ System.err.println(ex);
} finally {
config.save();
}
return false;
}
+ public static void deleteCategory(String category) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (config.hasCategory(category)) {
+ config.removeCategory(new ConfigCategory(category));
+ }
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
public static void reloadConfig() {
// Config init
if (!hasKey("toggles", "GParty")) writeBooleanConfig("toggles", "GParty", false);