use of cc.hyperium.utils.BetterJsonObject in project Hyperium by HyperiumClient.
the class ToggleChatConfig method loadToggles.
public void loadToggles() {
if (exists(toggleFile)) {
try {
FileReader fileReader = new FileReader(toggleFile);
BufferedReader reader = new BufferedReader(fileReader);
toggleJson = new BetterJsonObject(reader.lines().collect(Collectors.joining()));
fileReader.close();
reader.close();
} catch (Exception ex) {
log("Could not read toggles properly, saving.");
saveToggles();
}
theMod.getToggleHandler().getToggles().values().forEach(base -> base.setEnabled(toggleJson.has("show" + base.getName().replace(" ", "_")) && toggleJson.get("show" + base.getName().replace(" ", "_")).getAsBoolean()));
} else {
saveToggles();
}
}
use of cc.hyperium.utils.BetterJsonObject in project Hyperium by HyperiumClient.
the class KeyBindConfig method load.
public void load() {
if (exists(keybindFile)) {
try {
FileReader fileReader = new FileReader(keybindFile);
BufferedReader reader = new BufferedReader(fileReader);
keyBindJson = new BetterJsonObject(reader.lines().collect(Collectors.joining()));
fileReader.close();
reader.close();
} catch (Exception ex) {
// Error occured while loading
save();
return;
}
handler.getKeybinds().values().forEach(bind -> bind.setKeyCode(keyBindJson.optInt(bind.getRealDescription(), bind.getDefaultKeyCode())));
} else {
// Config file doesn't exist, yay!
save();
}
}
Aggregations