# Code Request — Task #69: Discord Rules Mod Generic Fork

**Filed by:** Chronicler #84
**Date:** 2026-04-12
**Priority:** Medium
**Task DB ID:** 69

---

## What You're Building

Fork the Firefrost Rules Mod into a generic, community-ready mod called **"Discord Rules"** for CurseForge publication. Strip all Firefrost branding and make colors configurable.

The source is in `services/rules-mod/` (3 versions: 1.21.1, 1.20.1, 1.16.5).
Put the generic fork in `services/discord-rules/` (same 3-version structure).

---

## Changes Required Per Version

### 1. Package rename
- `com.firefrostgaming.rules` → `com.discordrules`

### 2. Mod metadata (mods.toml / neoforge.mods.toml)
- modId: `serverrules` → `discordrules`
- displayName: `"Firefrost Rules"` → `"Discord Rules"`
- description: generic (see below)
- authors: `"Firefrost Gaming"` → `"FirefrostGaming"` (keep as author, it's our brand)
- license: add `MIT`
- logoFile: remove or replace with generic

### 3. DiscordFormatter.java — replace hardcoded color logic

Current (remove this entire block):
```java
ChatFormatting headerColor = ChatFormatting.DARK_PURPLE;
ChatFormatting bodyColor = ChatFormatting.LIGHT_PURPLE;
if (lowerText.contains("fire") || lowerText.contains("[fire]")) {
    headerColor = ChatFormatting.GOLD;
    bodyColor = ChatFormatting.YELLOW;
} else if (lowerText.contains("frost") || lowerText.contains("[frost]")) {
    headerColor = ChatFormatting.AQUA;
    bodyColor = ChatFormatting.DARK_AQUA;
}
```

Replace with: read `headerColor` and `bodyColor` from config (see step 4).

Also in `convertEmojis()`: remove the Fire/Frost/Arcane specific replacements:
```java
// REMOVE these 3 lines:
.replace("\uD83D\uDD25", "[Fire]")
.replace("\u2744\uFE0F", "[Frost]")
.replace("\uD83D\uDC9C", "[Arcane]")
```
Keep the generic emoji strip: `.replaceAll("[\\x{1F300}-\\x{1F9FF}]", "")`
But make the emoji stripping a config toggle (see step 4).

### 4. ServerRulesConfig.java — add display section

Add a new `display` config section with these fields:

```
[display]
# Header color (bold lines). Valid values: BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA,
# DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED,
# LIGHT_PURPLE, YELLOW, WHITE
header_color = "GOLD"

# Body color (regular lines and bullet points)
body_color = "YELLOW"

# Strip emojis that Minecraft can't render (recommended: true)
strip_emojis = true
```

The formatter reads these at display time (not cached — config changes take effect on next /rules without restart).

### 5. DiscordFormatter.java — wire config reads

```java
// At top of formatRules():
ChatFormatting headerColor = parseColor(ServerRulesConfig.HEADER_COLOR.get(), ChatFormatting.GOLD);
ChatFormatting bodyColor = parseColor(ServerRulesConfig.BODY_COLOR.get(), ChatFormatting.YELLOW);

// Add helper method:
private static ChatFormatting parseColor(String name, ChatFormatting fallback) {
    try {
        return ChatFormatting.valueOf(name.toUpperCase());
    } catch (IllegalArgumentException e) {
        return fallback;
    }
}
```

For emoji stripping, gate `convertEmojis()` on the config value:
```java
String processedText = ServerRulesConfig.STRIP_EMOJIS.get() 
    ? convertEmojis(rawDiscordText) 
    : rawDiscordText;
```

### 6. ServerRules.java — update mod ID references
- Any string `"serverrules"` → `"discordrules"`
- Any string `"Firefrost"` or `"FireFrost"` in user-visible text → remove or make generic

---

## Build Instructions

Same as Task #136 — use the Dev Panel build environment:

```bash
# Java 21 for 1.21.1
use-java 21
cd /opt/mod-builds/firefrost-services/services/discord-rules/1.21.1
/opt/gradle-8.8/bin/gradle build

# Java 17 for 1.20.1
use-java 17
cd /opt/mod-builds/firefrost-services/services/discord-rules/1.20.1
/opt/gradle-8.8/bin/gradle build

# Java 8 for 1.16.5
use-java 8
cd /opt/mod-builds/firefrost-services/services/discord-rules/1.16.5
/opt/gradle-7.6.4/bin/gradle build
```

Output jars go in `build/libs/` — grab the one without `-sources` or `-dev`.

---

## Deliverable

3 built jars in `services/discord-rules/`:
- `discord-rules-1.0.0-1.21.1-neoforge.jar`
- `discord-rules-1.0.0-1.20.1-forge.jar`
- `discord-rules-1.0.0-1.16.5-forge.jar`

Commit source + jars to `firefrost-services` main branch, then update `ACTIVE_CONTEXT.md`.

---

## Notes

- Don't touch `services/rules-mod/` — that stays as Firefrost's internal version
- Default colors GOLD/YELLOW chosen to match Firefrost's visual identity (subtle brand nod)
- MIT license — maximizes community adoption
- Chronicler is writing the CurseForge project page copy in parallel

**Fire + Frost + Foundation** 💙🔥❄️
