MCPcopy Create free account
hub / github.com/MCSLTeam/MCSL2 / readServerProperties

Function readServerProperties

MCSL2Lib/ServerControllers/serverUtils.py:103–118  ·  view source on GitHub ↗
(serverConfig: ServerVariables)

Source from the content-addressed store, hash-verified

101
102
103def readServerProperties(serverConfig: ServerVariables):
104 serverConfig.serverProperties.clear()
105 try:
106 with open(
107 f"./Servers/{serverConfig.serverName}/server.properties",
108 "r",
109 encoding="utf-8",
110 ) as serverPropertiesFile:
111 lines = serverPropertiesFile.readlines()
112 for line in lines:
113 line = line.strip()
114 if line and not line.startswith("#"):
115 key, value = line.split("=", 1)
116 serverConfig.serverProperties[key.strip()] = value.strip()
117 except FileNotFoundError:
118 serverConfig.serverProperties.update({"msg": "File not found"})
119
120
121# class CrashMCAnalyzerThread(QThread):

Callers 2

colorConsoleTextMethod · 0.90
backupSavesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected