Skip to content

Commit

Permalink
Update night-config to improve config saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Jul 31, 2024
1 parent bbefb88 commit 980f34e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@
- Updated Ukrainian translations ([#195](https://github.com/LambdAurora/LambDynamicLights/pull/195)).
- Updated to Minecraft 1.20.4 ([#202](https://github.com/LambdAurora/LambDynamicLights/pull/202)).

## 3.0.0

- Updated to Minecraft 1.21 ([#227](https://github.com/LambdAurora/LambDynamicLights/pull/227))
- Updated configuration library.
- Configuration corruption should now be fixed.
- Updated Mexican Spanish translations ([#214](https://github.com/LambdAurora/LambDynamicLights/pull/214)).
- Switched license to [Lambda License](https://github.com/LambdAurora/LambDynamicLights/blob/bbefb8860bca2e797f8a2ba8a59d1120b6e1c7b4/LICENSE).

[SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page"
[pridelib]: https://github.com/Queerbric/pridelib "Pridelib page"
[Sodium]: https://modrinth.com/mod/sodium "Sodium Modrinth page"
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ modmenu = "11.0.1"
sodium = "mc1.21-0.5.9"

# Configuration
nightconfig = "3.6.6"
nightconfig = "3.8.1"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package dev.lambdaurora.lambdynlights;

import com.electronwill.nightconfig.core.file.FileConfig;
import com.electronwill.nightconfig.core.io.WritingMode;
import dev.lambdaurora.lambdynlights.config.BooleanSettingEntry;
import dev.lambdaurora.lambdynlights.config.SettingEntry;
import dev.lambdaurora.spruceui.option.SpruceCyclingOption;
Expand Down Expand Up @@ -61,7 +62,11 @@ public class DynamicLightsConfig {
public DynamicLightsConfig(@NotNull LambDynLights mod) {
this.mod = mod;

this.config = FileConfig.builder(CONFIG_FILE_PATH).concurrent().defaultResource("/lambdynlights.toml").autosave().build();
this.config = FileConfig.builder(CONFIG_FILE_PATH)
.defaultResource("/lambdynlights.toml")
.autosave()
.writingMode(WritingMode.REPLACE_ATOMIC)
.build();
this.entitiesLightSource = new BooleanSettingEntry("light_sources.entities", DEFAULT_ENTITIES_LIGHT_SOURCE, this.config,
Text.translatable("lambdynlights.tooltip.entities"))
.withOnSet(value -> {
Expand Down
28 changes: 14 additions & 14 deletions src/main/resources/lambdynlights.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# The dynamic lights mode
mode = "fancy"

# Light sources settings.
# Light sources settings.
[light_sources]
# Enable entities light source.
entities = true
# Enable first-person player light source.
self = true
# Enable block entities light source.
block_entities = true
# Enables water-sensitive light sources check. This means that water-sensitive items will not light up when submerged in water.
water_sensitive_check = true
# Creeper lighting mode. May be off, simple or fancy.
creeper = "simple"
# TNT lighting mode. May be off, simple or fancy.
tnt = "off"
# Enable entities light source.
entities = true
# Enable first-person player light source.
self = true
# Enable block entities light source.
block_entities = true
# Enables water-sensitive light sources check. This means that water-sensitive items will not light up when submerged in water.
water_sensitive_check = true
# Creeper lighting mode. May be off, simple or fancy.
creeper = "simple"
# TNT lighting mode. May be off, simple or fancy.
tnt = "off"

[light_sources.settings.entities.minecraft]
glow_item_frame = false
glow_item_frame = false

0 comments on commit 980f34e

Please sign in to comment.