[+] Now include the server's version before launching

This commit is contained in:
Charles Le Maux 2024-09-13 04:02:07 +02:00
parent 9756697420
commit 11fcb0f89c

View File

@ -236,10 +236,12 @@ def server_run(user: UserRecord, name: str) -> tuple[HTTPStatus, Union[str, None
mc_manager.set_cooldown(user_id=user_id)
try:
port: int = firebase_manager.get_server_port(user_id)
server_id = mc_manager.start_server(f"users/{user_id}/{name}", port, user_id, name)
version: str = firebase_manager.get_server_field(user_id, name, "version")
if version is None:
return HTTPStatus.NOT_FOUND, f"Server {name} not found."
server_id = mc_manager.start_server(f"users/{user_id}/{name}", port, user_id, name, version)
if server_id is None:
return HTTPStatus.OK, f"You cannot run multiples instances at this time."
mc_manager.servers[server_id]['port'] = int(port)
try:
firebase_manager.update_server_running_state(user_id, name, True)
except Exception as e:
@ -324,5 +326,6 @@ def run_command(user: UserRecord, command: str, name: str) -> tuple[HTTPStatus,
def scheduled_actions() -> None:
mc_manager.check_servers_idle()
if __name__ == "__main__":
pass