Skip to content

Commit

Permalink
fix: šŸ› Added a try catch to prevent crashes when config tries to saveā€¦
Browse files Browse the repository at this point in the history
ā€¦ in curseforge launcher which seems to lock config file
  • Loading branch information
P3pp3rF1y committed Dec 31, 2024
1 parent 1224f98 commit 52e85a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ loader_version_range=[4,)
mod_id=sophisticatedcore
mod_name=Sophisticated Core
mod_license=GNU General Public License v3.0
mod_version=1.0.9
mod_version=1.0.10
mod_group_id=sophisticatedcore
mod_authors=P3pp3rF1y
mod_description=A library / shared functionality mod for Sophisticated Storage and Backpacks
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/p3pp3rf1y/sophisticatedcore/Config.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.p3pp3rf1y.sophisticatedcore;

import com.electronwill.nightconfig.core.io.WritingException;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
Expand Down Expand Up @@ -93,7 +94,11 @@ private void addEnabledItemToConfig(ResourceLocation itemRegistryName) {
List<String> list = itemsEnableList.get();
list.add(itemRegistryName + "|true");
itemsEnableList.set(list);
COMMON_SPEC.save();
try {
COMMON_SPEC.save();
} catch (WritingException e) {
SophisticatedCore.LOGGER.warn("Failed to save common config", e);
}
}

private void loadEnabledMap() {
Expand Down

0 comments on commit 52e85a8

Please sign in to comment.