From 11fcb0f89cb433a911a4699f487c17f32473c3b8 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Fri, 13 Sep 2024 04:02:07 +0200 Subject: [PATCH] [+] Now include the server's version before launching --- generic_executor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generic_executor.py b/generic_executor.py index 80003c3..c22905f 100644 --- a/generic_executor.py +++ b/generic_executor.py @@ -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