Config Validation System - MisterWonderful/DivineHordes GitHub Wiki
🔍 Configuration Validation System
🛡️ Built-in Safety Features
1. Type Validation
# Automatically validates data types
events:
interval:
min: "invalid" # ❌ String where number expected
# Plugin logs error and uses default (8)
2. Range Checking
# Ensures values stay within logical bounds
difficulty:
max-multiplier: -1.0 # ❌ Negative multiplier
# Plugin logs warning and uses default (3.0)
3. Dependency Validation
# Checks for conflicting settings
offerings:
max-changes: 0 # ❌ No changes allowed
xp-cost:
base-cost: 50 # ❌ But high XP cost set
# Plugin warns about conflicting configuration
🔄 Fallback System
Priority Order:
- User Configuration - Uses config.yml values if valid
- Default Values - Falls back to hardcoded defaults if invalid
- Safe Mode - Minimal functionality if critical errors detected
Example Fallback Chain:
# User config.yml
offerings:
items:
common: [] # ❌ Empty list
# Plugin response:
# 1. Logs warning about empty offering list
# 2. Falls back to hardcoded safe offerings
# 3. Uses: ["DIAMOND:3", "IRON_INGOT:10", "EMERALD:5"]
# 4. Continues normal operation