Documentation
¶
Index ¶
- Constants
- func DetectModpackLoader(candidates ...string) (models.ModLoader, bool)
- func FindMostRecentMinecraftVersion(versions []string) string
- func GenerateVelocitySecret() (string, error)
- func GetAllConfigs(serverDataPath string, loader models.ModLoader) (map[string]any, error)
- func GetAllVersions() []string
- func GetJavaVersion(mcVersion string) (string, error)
- func GetLatestSnapshot() string
- func GetLatestVersion() string
- func GetModsPath(serverDataPath string, loader models.ModLoader) string
- func GetProtocolVersion(mcVersion string) int
- func GetTPSCommand(modLoader models.ModLoader) string
- func GetVersionDate(version string) (time.Time, error)
- func GetVersions() []string
- func IsSnapshot(version string) bool
- func IsValidModFile(filename string, loader models.ModLoader) bool
- func IsValidVersion(version string) bool
- func LoadYAMLConfig(serverDataPath string, configFile ConfigFile) (map[string]any, error)
- func MatchModLoader(input string) (models.ModLoader, bool)
- func ParsePlayerListFromOutput(output string) (int, []string)
- func ParseTPSFromOutput(output string) float64
- func SaveServerProperties(serverDataPath string, properties ServerProperties) error
- func SaveYAMLConfig(serverDataPath string, configFile ConfigFile, config map[string]any) error
- func SyncVelocitySecretToDataPath(dataPath string, secret string) (string, error)
- type ConfigFile
- type LatestVersions
- type ModLoaderInfo
- type ProtocolVersionEntry
- type SLPClient
- type SLPResult
- type ServerProperties
- func (p ServerProperties) GetBool(key string, defaultValue bool) bool
- func (p ServerProperties) GetInt(key string, defaultValue int) int
- func (p ServerProperties) GetString(key string, defaultValue string) string
- func (p ServerProperties) SetBool(key string, value bool)
- func (p ServerProperties) SetInt(key string, value int)
- func (p ServerProperties) SetString(key, value string)
- type Version
- type VersionManifestV2
- type VersionMetadata
Constants ¶
const (
SettingVelocitySecret = "velocity_forwarding_secret"
)
Variables ¶
This section is empty.
Functions ¶
func DetectModpackLoader ¶
Inspects candidate strings for modloader identification
func GenerateVelocitySecret ¶
GenerateVelocitySecret generates a cryptographically secure 32-byte (256-bit) secret
func GetAllConfigs ¶
GetAllConfigs returns all configuration files for a server
func GetJavaVersion ¶
Fetches required Java version for a specific Minecraft version
func GetModsPath ¶
GetModsPath returns the path where mods should be stored for a given server
func GetProtocolVersion ¶
Get protocol version for a Minecraft version string
func GetTPSCommand ¶
func GetVersionDate ¶
Returns the release date of a Minecraft version
func IsValidModFile ¶
IsValidModFile checks if a file is a valid mod file for the given loader
func IsValidVersion ¶
Checks if a given version string is a valid Minecraft version
func LoadYAMLConfig ¶
func LoadYAMLConfig(serverDataPath string, configFile ConfigFile) (map[string]any, error)
LoadYAMLConfig loads a YAML configuration file
func ParsePlayerListFromOutput ¶
ParsePlayerListFromOutput parses player count and names from list command output.
func ParseTPSFromOutput ¶
ParseTPSFromOutput parses TPS value from various server command outputs.
func SaveServerProperties ¶
func SaveServerProperties(serverDataPath string, properties ServerProperties) error
SaveServerProperties saves the server.properties file
func SaveYAMLConfig ¶
func SaveYAMLConfig(serverDataPath string, configFile ConfigFile, config map[string]any) error
SaveYAMLConfig saves a YAML configuration file
Types ¶
type ConfigFile ¶
type ConfigFile string
ConfigFile represents a generic configuration file type
const ( ConfigServerProperties ConfigFile = "server.properties" ConfigBukkit ConfigFile = "bukkit.yml" ConfigSpigot ConfigFile = "spigot.yml" ConfigPaper ConfigFile = "paper.yml" ConfigPaperGlobal ConfigFile = "config/paper-global.yml" ConfigPaperWorld ConfigFile = "config/paper-world-defaults.yml" )
func GetConfigFiles ¶
func GetConfigFiles(loader models.ModLoader) []ConfigFile
GetConfigFiles returns the configuration files for a specific mod loader
type LatestVersions ¶
type ModLoaderInfo ¶
type ModLoaderInfo struct {
Name string
DisplayName string
Description string
Category string
ModsDirectory string
ConfigDirectory string
SupportedVersions []string
FileExtensions []string
}
ModLoaderInfo contains information about a specific mod loader
func GetAllModLoaders ¶
func GetAllModLoaders() []ModLoaderInfo
GetAllModLoaders returns information about all available mod loaders
func GetModLoaderInfo ¶
func GetModLoaderInfo(loader models.ModLoader) ModLoaderInfo
GetModLoaderInfo returns information about a specific mod loader
type ProtocolVersionEntry ¶
type SLPClient ¶
type SLPClient struct {
// contains filtered or unexported fields
}
Implements the Minecraft Server List Ping protocol
type SLPResult ¶
type SLPResult struct {
Version struct {
Name string `json:"name"`
Protocol int `json:"protocol"`
} `json:"version"`
Players struct {
Max int `json:"max"`
Online int `json:"online"`
Sample []struct {
Name string `json:"name"`
ID string `json:"id"`
} `json:"sample"`
} `json:"players"`
Description json.RawMessage `json:"description"`
Favicon string `json:"favicon,omitempty"`
EnforcesSecure bool `json:"enforcesSecureChat,omitempty"`
LatencyMs int64
MOTD string // Parsed from Description
PlayerNames []string // Extracted player names
}
Parsed response from a server list ping
type ServerProperties ¶
ServerProperties represents the Minecraft server.properties file
func LoadServerProperties ¶
func LoadServerProperties(serverDataPath string) (ServerProperties, error)
LoadServerProperties loads the server.properties file from a server's data directory
func (ServerProperties) GetBool ¶
func (p ServerProperties) GetBool(key string, defaultValue bool) bool
func (ServerProperties) GetString ¶
func (p ServerProperties) GetString(key string, defaultValue string) string
func (ServerProperties) SetBool ¶
func (p ServerProperties) SetBool(key string, value bool)
func (ServerProperties) SetInt ¶
func (p ServerProperties) SetInt(key string, value int)
func (ServerProperties) SetString ¶
func (p ServerProperties) SetString(key, value string)
type Version ¶
type Version struct {
ID string `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
Time time.Time `json:"time"`
ReleaseTime time.Time `json:"releaseTime"`
SHA1 string `json:"sha1"`
ComplianceLevel int `json:"complianceLevel"`
}
A single Minecraft version entry
func GetVersionInfo ¶
Returns detailed information about a specific version
type VersionManifestV2 ¶
type VersionManifestV2 struct {
Latest LatestVersions `json:"latest"`
Versions []Version `json:"versions"`
}
type VersionMetadata ¶
type VersionMetadata struct {
JavaVersion struct {
Component string `json:"component"`
MajorVersion int `json:"majorVersion"`
} `json:"javaVersion"`
}
Metadata for a specific version