[~] Coding style

This commit is contained in:
Charles Le Maux 2024-09-16 01:52:27 +02:00
parent 20047990b5
commit 21fb9f1286

View File

@ -21,7 +21,8 @@ class MinecraftServerManager:
self.offline_ports: list[int] = [] self.offline_ports: list[int] = []
def start_server(self, server_directory: str, port: int, user_id: str, server_name: str, def start_server(self, server_directory: str, port: int, user_id: str, server_name: str,
version: str, jar_file: str = 'server.jar', memory_size: str ='4G', modded: bool = False) -> Union[int, None]: version: str, jar_file: str = 'server.jar',
memory_size: str ='4G', modded: bool = False) -> Union[int, None]:
if port in self.servers: if port in self.servers:
return None return None
@ -40,6 +41,7 @@ class MinecraftServerManager:
command = f"{java} -Xmx{memory_size} {reg_flags} -jar {jar_file} --nogui" command = f"{java} -Xmx{memory_size} {reg_flags} -jar {jar_file} --nogui"
if modded: if modded:
command = "./start.sh" command = "./start.sh"
process = subprocess.Popen(shlex.split(command), cwd=server_directory, stdin=subprocess.PIPE) process = subprocess.Popen(shlex.split(command), cwd=server_directory, stdin=subprocess.PIPE)
#TODO: Track process behavior and stderr, while excepting Advanced Terminal features not to be avail. #TODO: Track process behavior and stderr, while excepting Advanced Terminal features not to be avail.