This repository was archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.py
More file actions
44 lines (38 loc) · 1.32 KB
/
start.py
File metadata and controls
44 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import subprocess
import threading
import optifine_server
from contextlib import redirect_stdout, redirect_stderr
DEBUG = os.path.exists(".debug")
def mc_server():
if not DEBUG:
with open("log.java.txt", "w+") as log:
with redirect_stdout(log):
with redirect_stderr(log):
subprocess.call("java -jar server.jar --nogui", shell=True)
else:
subprocess.call("java -jar server.jar --nogui", shell=True)
def optifine_serve():
server = optifine_server.Server(DEBUG)
if not DEBUG:
with open("log.optifine.txt", "w+") as log:
with redirect_stdout(log):
with redirect_stderr(log):
server.start()
else:
server.start()
server_thread = threading.Thread(target=mc_server)
optifine_thread = threading.Thread(target=optifine_serve)
server_thread.start()
optifine_thread.start()
if DEBUG:
import api
server = api.Server(DEBUG)
server.start()
else:
with open("log.api.txt", "w+") as log:
with redirect_stdout(log):
with redirect_stderr(log):
subprocess.run("python3 -m gunicorn --certfile=ssl/domain.cert.pem --keyfile=ssl/private.key.pem --bind 0.0.0.0:443 \"wsgi:create_server()\"", shell=True)
server_thread.join()
optifine_thread.join()