Skip to content

Commit

Permalink
Change loadConfig method return value to boolean
Browse files Browse the repository at this point in the history
Update fabric.mod.json
  • Loading branch information
Libreh committed Feb 13, 2025
1 parent d33d9a2 commit 1c534f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/main/java/me/libreh/rulebook/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public static class Rule {

public List<UUID> acceptedPlayers = new ArrayList<>();

public static boolean loadConfig() {
public static void loadConfig() {
Config oldConfig = CONFIG;
boolean success;

CONFIG = null;
try {
Expand All @@ -66,15 +65,11 @@ public static boolean loadConfig() {

}
saveConfig();
success = true;
} catch (IOException exception) {
success = false;
CONFIG = oldConfig;
Rulebook.LOGGER.error("Something went wrong while reading config!");
exception.printStackTrace();
}

return success;
}

public static void saveConfig() {
Expand All @@ -90,7 +85,7 @@ public static void saveConfig() {
}

private static File getConfigFile() {
return new File(FabricLoader.getInstance().getConfigDir().toFile(), "rulebook.json");
return new File(FabricLoader.getInstance().getConfigDir().toFile(), Rulebook.MOD_ID + ".json");
}

public static boolean hasAccepted(ServerPlayerEntity player) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "rulebook",
"version": "${version}",
"name": "Rulebook",
"description": "Server-side rulebook mod for Fabric",
"description": "Rules screening mod",
"authors": [
"Libreh"
],
Expand Down

0 comments on commit 1c534f9

Please sign in to comment.