Skip to content

Commit

Permalink
feat: Fix missing config values
Browse files Browse the repository at this point in the history
Fixed memory color toggle and time format on reload
  • Loading branch information
TreyRuffy committed Nov 13, 2023
1 parent b9d5667 commit d8f17f4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-tasks.yml
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Run Crowdin Action
uses: crowdin/github-action@1.4.13
with:
upload_sources: true
upload_sources: false
upload_translations: false

download_translations: true
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 - 2022 cominixo / TreyRuffy
Copyright (c) 2020 - 2023 cominixo / TreyRuffy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Expand Up @@ -388,12 +388,8 @@ private static BaseModule loadModule(final Config moduleConfig) {
}

if (baseModule instanceof SystemModule systemModule) {
if (systemModule.memoryColorToggle == null) {
systemModule.memoryColorToggle = moduleConfig.getOrElse("memory_color_toggle", systemModule.defaultMemoryColorToggle);
}
if (systemModule.timeFormat == null) {
systemModule.timeFormat = moduleConfig.getOrElse("time_format", systemModule.defaultTimeFormat);
}
systemModule.memoryColorToggle = moduleConfig.getOrElse("memory_color_toggle", systemModule.defaultMemoryColorToggle);
systemModule.timeFormat = moduleConfig.getOrElse("time_format", systemModule.defaultTimeFormat);
}

baseModule.enabled = moduleConfig.getOrElse("enabled", true);
Expand Down Expand Up @@ -474,6 +470,15 @@ private static Config saveModule(final BaseModule module) {
moduleConfig.set("total_chunks_color", chunkModule.totalColor.getRgb());
}

if (module instanceof SystemModule systemModule) {
if (systemModule.memoryColorToggle != null) {
moduleConfig.set("memory_color_toggle", systemModule.memoryColorToggle);
}
if (systemModule.timeFormat != null) {
moduleConfig.set("time_format", systemModule.timeFormat);
}
}

moduleConfig.set("enabled", module.enabled);
moduleConfig.set("lines", lines);

Expand Down
Expand Up @@ -80,7 +80,7 @@ public Text toText(final TextColor nameColor, final TextColor valueColor) {
} else {
valueStyled = Utils.styledText(this.value, valueColor);
}
if (this.value.toString().equals("")) {
if (this.value.toString().isEmpty()) {
this.active = false;
}
return Text.translatable(this.format, nameStyled, valueStyled);
Expand All @@ -99,7 +99,7 @@ public Text toTextCustom(final TextColor nameColor) {
// format properly if value is a List (bad)
final List<Object> values = new ArrayList<>();

if (!name.equals("")) {
if (!name.isEmpty()) {
values.add(Utils.styledText(name, nameColor));
}
values.addAll(listValue);
Expand Down
1 change: 1 addition & 0 deletions fabric/build.gradle
Expand Up @@ -65,6 +65,7 @@ processResources {
shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
relocate 'com.electronwill.nightconfig', 'me.cominixo.betterf3.libs.nightconfig'
}

remapJar {
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Expand Up @@ -11,8 +11,8 @@
],
"contact": {
"homepage": "https://modrinth.com/mod/betterf3",
"sources": "https://github.com/cominixo/BetterF3.git",
"issues": "https://github.com/cominixo/BetterF3/issues/"
"sources": "https://github.com/TreyRuffy/BetterF3.git",
"issues": "https://github.com/TreyRuffy/BetterF3/issues/"
},
"license": "MIT",
"environment": "client",
Expand Down

0 comments on commit d8f17f4

Please sign in to comment.