# RCON Package This package provides an interface for interacting with Minecraft servers via RCON (Remote Console). ## Features - Connect to Minecraft servers using RCON protocol - Execute commands on the server - Set weather, time, and difficulty - Health checking and connection management - Timeout support for operations - Environment variable based configuration ## Usage ```go import "tipsy.codes/charles/mc-god/v2/internal/pkg/rcon" // Create a new client using environment variables client, err := rcon.NewFromEnv() if err != nil { log.Fatal(err) } defer client.Close() // Execute a command response, err := client.Execute("list") if err != nil { log.Fatal(err) } fmt.Println(response) // Set weather to clear err = client.SetWeather("clear") if err != nil { log.Fatal(err) } ``` ## Environment Variables The package expects these environment variables to be set: - `RCON_ADDRESS` - The address of the Minecraft server (e.g., "localhost:25575") - `RCON_PASSWORD` - The RCON password for authentication ## Methods - `New(address, password)` - Create a new RCON client - `Execute(command)` - Execute a command on the server - `SetWeather(weather)` - Set the weather (clear, rain, thunder) - `SetTime(timeValue)` - Set the time (day, night, noon, midnight, or numeric) - `SetDifficulty(difficulty)` - Set the difficulty level (peaceful, easy, normal, hard) - `GetServerInfo()` - Get server version information - `Close()` - Close the RCON connection - `HealthCheck()` - Verify the connection is working - `ExecuteWithTimeout()` - Execute command with timeout - `ConnectWithTimeout()` - Connect with timeout - `GetEnvCredentials()` - Get credentials from environment - `NewFromEnv()` - Create client from environment variables