2023-10-01 14:20:22 +00:00
|
|
|
"""
|
|
|
|
This module prepares the necessary files for running the server in the
|
|
|
|
correct configuration.
|
|
|
|
"""
|
2021-07-31 13:26:09 +00:00
|
|
|
|
2023-10-01 14:20:22 +00:00
|
|
|
import config
|
2023-10-01 01:05:53 +00:00
|
|
|
|
2023-10-01 14:20:22 +00:00
|
|
|
def write_eula():
|
|
|
|
"""
|
|
|
|
Write whether the user accepts to Minecraft's EULA.
|
|
|
|
The server refuses to run unless explicitly accepted.
|
|
|
|
"""
|
|
|
|
with open("eula.txt", 'w') as fp:
|
|
|
|
if config.EULA == True:
|
|
|
|
fp.write("eula=true")
|
|
|
|
else:
|
|
|
|
fp.write("eula=false")
|
|
|
|
|
|
|
|
def write_server_properties():
|
|
|
|
"""
|
|
|
|
Write the configuration for the Minecraft world.
|
|
|
|
"""
|
|
|
|
with open("server.properties", 'w') as fp:
|
|
|
|
for key, value in config.at(['minecraft']).items():
|
|
|
|
fp.write(f"{key}={value}\n")
|