forked from The-Alpha-Project/alpha-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (22 loc) · 1.04 KB
/
main.py
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
import threading
import colorama
from apscheduler.schedulers.background import BackgroundScheduler
from game.realm import RealmManager
from game.world import WorldManager
from utils.ConfigManager import config
from database.realm.RealmDatabaseManager import RealmDatabaseManager
from utils.Logger import Logger
if __name__ == '__main__':
# initialize colorama to make ansi codes work in Windows
colorama.init()
login_thread = threading.Thread(target=RealmManager.LoginServerSessionHandler.start)
login_thread.start()
proxy_thread = threading.Thread(target=RealmManager.ProxyServerSessionHandler.start)
proxy_thread.start()
world_thread = threading.Thread(target=WorldManager.WorldServerSessionHandler.start)
world_thread.start()
realm_saving_scheduler = BackgroundScheduler()
realm_saving_scheduler._daemon = True
realm_saving_scheduler.add_job(RealmDatabaseManager.save, 'interval',
seconds=config.Server.Settings.realm_saving_interval_seconds)
realm_saving_scheduler.start()