Skip to main content

Overview

The AutoConfig system automatically loads optimal module configurations based on the server you’re connected to. It downloads configs from the LiquidBounce API and applies them seamlessly. Package: net.ccbluex.liquidbounce.config.autoconfig

Object Declaration

object AutoConfig

Properties

loadingNow
Boolean
Whether a config is currently being loaded.
@Volatile
var loadingNow: Boolean
When true, module toggle notifications are suppressed.
includeConfiguration
IncludeConfiguration
Determines which settings to include when saving configs.
var includeConfiguration: IncludeConfiguration
configs
Array<AutoSettings>?
Available auto-configs from the API.
@Volatile
var configs: Array<AutoSettings>?
    private set

Core Methods

reloadConfigs

suspend fun reloadConfigs(): Boolean
Reloads the list of available auto-configs from the LiquidBounce API. Returns: true if successfully reloaded, false on error Example:
val success = AutoConfig.reloadConfigs()
if (success) {
    println("Found ${AutoConfig.configs?.size} configs")
}

withLoading

inline fun withLoading(block: () -> Unit)
Executes code block with loadingNow flag set. Example:
AutoConfig.withLoading {
    // Load config
    // Notifications suppressed during this block
}

AutoSettings Class

data class AutoSettings(
    val name: String,
    val type: AutoSettingsType,
    val status: AutoSettingsStatusType,
    val server: String?,
    val protocolVersion: Int?
)
name
String
Config name/identifier
type
AutoSettingsType
Config category (Server, Minigame, Global)
status
AutoSettingsStatusType
Config status (Active, Experimental, Deprecated)
server
String?
Target server address (null for global configs)
protocolVersion
Int?
Target Minecraft protocol version (null for any version)

AutoSettingsType Enum

enum class AutoSettingsType {
    SERVER,     // Server-specific config (e.g., Hypixel)
    MINIGAME,   // Minigame-specific (e.g., BedWars, SkyWars)
    GLOBAL      // Global optimization config
}

AutoSettingsStatusType Enum

enum class AutoSettingsStatusType {
    ACTIVE,       // Tested and working
    EXPERIMENTAL, // New, might need adjustments
    DEPRECATED    // Old, may not work on current version
}

Usage Examples

Loading Available Configs

val configs = AutoConfig.configs
if (configs != null) {
    for (config in configs) {
        println("${config.name} - ${config.type}")
        println("  Status: ${config.status}")
        println("  Server: ${config.server ?: "Any"}")
    }
}

Filtering Configs

// Get configs for current server
val currentServer = mc.currentServer?.ip
val serverConfigs = AutoConfig.configs?.filter {
    it.server?.equals(currentServer, ignoreCase = true) == true
}

// Get active configs only
val activeConfigs = AutoConfig.configs?.filter {
    it.status == AutoSettingsStatusType.ACTIVE
}

// Get minigame configs
val minigameConfigs = AutoConfig.configs?.filter {
    it.type == AutoSettingsType.MINIGAME
}

Loading Config Programmatically

suspend fun loadConfigForServer(serverIp: String) {
    // Reload available configs
    if (!AutoConfig.reloadConfigs()) {
        chat("Failed to load configs from API")
        return
    }
    
    // Find matching config
    val config = AutoConfig.configs?.firstOrNull {
        it.server?.equals(serverIp, ignoreCase = true) == true &&
        it.status == AutoSettingsStatusType.ACTIVE
    }
    
    if (config != null) {
        AutoConfig.withLoading {
            // Load config
            loadAutoConfig(config)
        }
        chat("Loaded config: ${config.name}")
    } else {
        chat("No config found for $serverIp")
    }
}

IncludeConfiguration

data class IncludeConfiguration(
    val includeBinds: Boolean = true,
    val includeHidden: Boolean = true,
    val includeEnabled: Boolean = true
)
includeBinds
Boolean
default:"true"
Include keybind settings in saved configs
includeHidden
Boolean
default:"true"
Include module hidden states in saved configs
includeEnabled
Boolean
default:"true"
Include module enabled states in saved configs

Customizing Config Export

// Save config without keybinds
AutoConfig.includeConfiguration = IncludeConfiguration(
    includeBinds = false,
    includeHidden = true,
    includeEnabled = true
)

ConfigSystem.store(ModuleManager.modulesConfig)

// Restore default
AutoConfig.includeConfiguration = IncludeConfiguration.DEFAULT

Automatic Loading

AutoConfig can automatically load configs when joining servers:
// Triggered on server join
EventManager.handler<ServerConnectEvent> { event ->
    val serverIp = event.serverInfo.address
    
    // Find matching config
    val config = AutoConfig.configs?.firstOrNull {
        it.server?.equals(serverIp, ignoreCase = true) == true &&
        it.type == AutoSettingsType.SERVER
    }
    
    if (config != null && ModuleAutoConfig.autoLoad) {
        AutoConfig.withLoading {
            loadAutoConfig(config)
        }
    }
}

Config Compatibility

AutoConfig handles protocol version compatibility:
val compatibleConfigs = AutoConfig.configs?.filter { config ->
    config.protocolVersion == null || 
    config.protocolVersion == mc.protocolVersion
}

Best Practices

  1. Check status before loading - Prefer ACTIVE over EXPERIMENTAL
  2. Reload configs periodically - Configs are updated on API
  3. Match protocol versions - Ensure config is for your MC version
  4. Suppress notifications during load - Use withLoading
  5. Provide fallback configs - Handle API failures gracefully
  6. Respect user preferences - Don’t auto-load without permission

Integration with ModuleAutoConfig

The AutoConfig module provides UI and automation:
object ModuleAutoConfig : ClientModule(...) {
    val autoLoad by boolean("AutoLoad", true)
    val preferActive by boolean("PreferActive", true)
    val notifyOnLoad by boolean("NotifyOnLoad", true)
}

API Endpoints

AutoConfig communicates with LiquidBounce API:
  • List Configs: GET /api/v1/client/autosettings
  • Download Config: GET /api/v1/client/autosettings/{name}

Error Handling

try {
    if (!AutoConfig.reloadConfigs()) {
        throw Exception("Failed to reload configs")
    }
    
    AutoConfig.withLoading {
        // Load config
    }
} catch (e: Exception) {
    logger.error("AutoConfig error", e)
    chat("Failed to load config: ${e.message}")
}

See Also

Build docs developers (and LLMs) love