v1.0.2: Fix config reset — switch from SERVER to COMMON config type

SERVER configs in world/serverconfig/ are tied to the world load/unload
lifecycle, causing Forge to overwrite edited values on every restart.
COMMON configs in config/ load once at startup and persist reliably.

Config location changed:
  firefrostrules: config/firefrostrules-common.toml
  discordrules:   config/discordrules-common.toml

All 6 builds updated (3 firefrostrules + 3 discordrules).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude (Chronicler #83 - The Compiler)
2026-04-13 17:22:39 -05:00
parent 996b59672f
commit 60740386ac
21 changed files with 51 additions and 36 deletions

View File

@@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
version = '1.0.1'
version = '1.0.2'
group = 'com.discordrules'
archivesBaseName = 'discordrules'

View File

@@ -16,7 +16,7 @@ public class ServerRules {
private static final Logger LOGGER = LogManager.getLogger(ServerRules.class);
public ServerRules() {
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ServerRulesConfig.SPEC);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onConfigLoaded);
MinecraftForge.EVENT_BUS.register(this);
LOGGER.info("Discord Rules Mod Initialized.");
@@ -26,7 +26,7 @@ public class ServerRules {
if (event.getConfig().getSpec() == ServerRulesConfig.SPEC) {
String token = ServerRulesConfig.BOT_TOKEN.get();
if (token.equals("YOUR_TOKEN_HERE")) {
LOGGER.warn("Rules mod is using default config values! Edit world/serverconfig/discordrules-server.toml");
LOGGER.warn("Rules mod is using default config values! Edit config/discordrules-common.toml");
} else {
LOGGER.info("Rules mod config loaded successfully. Channel: {}", ServerRulesConfig.CHANNEL_ID.get());
}

View File

@@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
version = '1.0.1'
version = '1.0.2'
group = 'com.discordrules'
archivesBaseName = 'discordrules'

View File

@@ -16,7 +16,7 @@ public class ServerRules {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerRules.class);
public ServerRules() {
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ServerRulesConfig.SPEC);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC);
MinecraftForge.EVENT_BUS.register(this);
LOGGER.info("Discord Rules Mod Initialized.");
}
@@ -37,7 +37,7 @@ public class ServerRules {
if (event.getConfig().getSpec() == ServerRulesConfig.SPEC) {
String token = ServerRulesConfig.BOT_TOKEN.get();
if (token.equals("YOUR_TOKEN_HERE")) {
LOGGER.warn("Rules mod is using default config values! Edit world/serverconfig/discordrules-server.toml");
LOGGER.warn("Rules mod is using default config values! Edit config/discordrules-common.toml");
} else {
LOGGER.info("Rules mod config loaded successfully. Channel: {}", ServerRulesConfig.CHANNEL_ID.get());
}

View File

@@ -6,5 +6,5 @@ neo_version=21.1.65
mod_id=discordrules
mod_name=Discord Rules
mod_version=1.0.1
mod_version=1.0.2
mod_group_id=com.discordrules

View File

@@ -17,7 +17,7 @@ public class ServerRules {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerRules.class);
public ServerRules(IEventBus modEventBus, ModContainer modContainer) {
modContainer.registerConfig(ModConfig.Type.SERVER, ServerRulesConfig.SPEC);
modContainer.registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC);
modEventBus.addListener(this::onConfigLoaded);
modEventBus.addListener(this::onConfigReload);
NeoForge.EVENT_BUS.register(this);
@@ -39,7 +39,7 @@ public class ServerRules {
if (event.getConfig().getSpec() == ServerRulesConfig.SPEC) {
String token = ServerRulesConfig.BOT_TOKEN.get();
if (token.equals("YOUR_TOKEN_HERE")) {
LOGGER.warn("Rules mod is using default config values! Edit world/serverconfig/discordrules-server.toml");
LOGGER.warn("Rules mod is using default config values! Edit config/discordrules-common.toml");
} else {
LOGGER.info("Rules mod config loaded successfully. Channel: {}", ServerRulesConfig.CHANNEL_ID.get());
}

View File

@@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
version = '1.0.1'
version = '1.0.2'
group = 'com.firefrostgaming.rules'
archivesBaseName = 'firefrostrules'

View File

@@ -16,7 +16,7 @@ public class ServerRules {
private static final Logger LOGGER = LogManager.getLogger(ServerRules.class);
public ServerRules() {
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ServerRulesConfig.SPEC);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onConfigLoaded);
MinecraftForge.EVENT_BUS.register(this);
LOGGER.info("Firefrost Rules Mod Initialized.");
@@ -26,7 +26,7 @@ public class ServerRules {
if (event.getConfig().getSpec() == ServerRulesConfig.SPEC) {
String token = ServerRulesConfig.BOT_TOKEN.get();
if (token.equals("YOUR_TOKEN_HERE")) {
LOGGER.warn("Rules mod is using default config values! Edit world/serverconfig/firefrostrules-server.toml");
LOGGER.warn("Rules mod is using default config values! Edit config/firefrostrules-common.toml");
} else {
LOGGER.info("Rules mod config loaded successfully. Channel: {}", ServerRulesConfig.CHANNEL_ID.get());
}

View File

@@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
version = '1.0.1'
version = '1.0.2'
group = 'com.firefrostgaming.rules'
archivesBaseName = 'firefrostrules'

View File

@@ -16,7 +16,7 @@ public class ServerRules {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerRules.class);
public ServerRules() {
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ServerRulesConfig.SPEC);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC);
MinecraftForge.EVENT_BUS.register(this);
LOGGER.info("Firefrost Rules Mod Initialized.");
}
@@ -37,7 +37,7 @@ public class ServerRules {
if (event.getConfig().getSpec() == ServerRulesConfig.SPEC) {
String token = ServerRulesConfig.BOT_TOKEN.get();
if (token.equals("YOUR_TOKEN_HERE")) {
LOGGER.warn("Rules mod is using default config values! Edit world/serverconfig/firefrostrules-server.toml");
LOGGER.warn("Rules mod is using default config values! Edit config/firefrostrules-common.toml");
} else {
LOGGER.info("Rules mod config loaded successfully. Channel: {}", ServerRulesConfig.CHANNEL_ID.get());
}

View File

@@ -6,5 +6,5 @@ neo_version=21.1.65
mod_id=firefrostrules
mod_name=Firefrost Rules
mod_version=1.0.1
mod_version=1.0.2
mod_group_id=com.firefrostgaming.rules

View File

@@ -17,7 +17,7 @@ public class ServerRules {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerRules.class);
public ServerRules(IEventBus modEventBus, ModContainer modContainer) {
modContainer.registerConfig(ModConfig.Type.SERVER, ServerRulesConfig.SPEC);
modContainer.registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC);
modEventBus.addListener(this::onConfigLoaded);
modEventBus.addListener(this::onConfigReload);
NeoForge.EVENT_BUS.register(this);
@@ -39,7 +39,7 @@ public class ServerRules {
if (event.getConfig().getSpec() == ServerRulesConfig.SPEC) {
String token = ServerRulesConfig.BOT_TOKEN.get();
if (token.equals("YOUR_TOKEN_HERE")) {
LOGGER.warn("Rules mod is using default config values! Edit world/serverconfig/firefrostrules-server.toml");
LOGGER.warn("Rules mod is using default config values! Edit config/firefrostrules-common.toml");
} else {
LOGGER.info("Rules mod config loaded successfully. Channel: {}", ServerRulesConfig.CHANNEL_ID.get());
}

View File

@@ -1,5 +1,26 @@
# Rules Mod Changelog
## [1.0.2] - 2026-04-13
### Fixed
- **Config reset on restart** — switched from `ModConfig.Type.SERVER` to `ModConfig.Type.COMMON`
- SERVER configs live in `world/serverconfig/` and are tied to world load/unload lifecycle, causing Forge to overwrite edited values on every restart
- COMMON configs live in `config/` and load once at startup — values persist reliably
### Changed
- Config location: `world/serverconfig/firefrostrules-server.toml``config/firefrostrules-common.toml`
- Config location (generic): `world/serverconfig/discordrules-server.toml``config/discordrules-common.toml`
- Updated `INSTALL.md` with new config path
### Breaking
- Old config file at `world/serverconfig/` will be ignored — must re-enter values in new `config/` location
### Applies To
- `firefrostrules` 1.0.2 (FFG branded, all 3 MC versions)
- `discordrules` 1.0.2 (generic/CurseForge fork, all 3 MC versions)
---
## [1.0.1] - 2026-04-13
### Fixed

View File

@@ -9,12 +9,9 @@
Player types `/rules` → mod fetches rules from a Discord message → displays in-game with colored formatting. Admins update rules by editing a Discord message — no restarts, no file editing.
## Config Location
Config file is created at `world/serverconfig/firefrostrules-server.toml` — NOT in `config/`. This applies to all three versions.
## Install Procedure (IMPORTANT)
Do NOT place config files manually before first start. Forge must generate the file.
See `INSTALL.md` for full steps. Placing a config manually causes Forge to overwrite
it with defaults on startup (missing version header → config reset bug).
Config file is at `config/firefrostrules-common.toml` (COMMON type).
Changed from SERVER to COMMON in v1.0.2 to fix config reset on restart.
See `INSTALL.md` for full install steps.
## 7 Source Files (each version)
- ServerRules.java — main mod class

View File

@@ -1,19 +1,11 @@
# Rules Mod — Install Procedure
## Important: Do NOT place config files manually
Forge generates `world/serverconfig/firefrostrules-server.toml` (or
`discordrules-server.toml` for the generic version) on first server start.
Placing a config file manually before the first run will cause Forge to
overwrite it with defaults — your bot token, channel ID, and message ID
will be lost.
## Correct Install Steps
1. Place the jar in the server's `mods/` folder
2. Start the server once — Forge generates the config with defaults
3. Stop the server
4. Edit `world/serverconfig/firefrostrules-server.toml`:
4. Edit `config/firefrostrules-common.toml` (or `config/discordrules-common.toml`):
- Set `bot_token` to your Discord bot token
- Set `channel_id` to the channel containing your rules message
- Set `message_id` to the specific message ID
@@ -28,10 +20,15 @@ Rules mod config loaded successfully. Channel: <your_channel_id>
If you see this instead, the config is still on defaults:
```
Rules mod is using default config values! Edit world/serverconfig/firefrostrules-server.toml
Rules mod is using default config values! Edit config/firefrostrules-common.toml
```
## Config Location
The config lives at `world/serverconfig/` — NOT `config/`.
This is standard Forge SERVER config behavior.
The config lives at `config/firefrostrules-common.toml` (COMMON type).
This loads once at startup and persists reliably across restarts.
## Upgrading from v1.0.0 or v1.0.1
Old versions used `world/serverconfig/firefrostrules-server.toml`.
That file is now ignored. Copy your values to the new location above.