mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Minor update
This commit is contained in:
parent
5244a1debd
commit
4221e8265f
@ -1,15 +1,15 @@
|
||||
# Developed by KuiToi Dev
|
||||
# File core.__init__.py
|
||||
# Written by: SantaSpeen
|
||||
# Version 0.1.0
|
||||
# Version 1.0
|
||||
# Licence: FPA
|
||||
# (c) kuitoi.su 2023
|
||||
|
||||
__title__ = 'KuiToi-Server'
|
||||
__description__ = 'BeamingDrive Multiplayer server compatible with BeamMP clients.'
|
||||
__url__ = 'https://github.com/kuitoi/kuitoi-Server'
|
||||
__version__ = '0.1.0'
|
||||
__build__ = 77
|
||||
__version__ = '0.1.1'
|
||||
__build__ = 81
|
||||
__author__ = 'SantaSpeen'
|
||||
__author_email__ = 'admin@kuitoi.su'
|
||||
__license__ = "FPA"
|
||||
@ -17,18 +17,21 @@ __copyright__ = 'Copyright 2023 © SantaSpeen (Maxim Khomutov)'
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import webbrowser
|
||||
|
||||
from core import utils
|
||||
from core.config_provider import ConfigProvider
|
||||
from prompt_toolkit.shortcuts import input_dialog, yes_no_dialog
|
||||
|
||||
from modules import ConfigProvider
|
||||
from main import parser
|
||||
from modules import Console
|
||||
from core.core import start
|
||||
from core.core import stop
|
||||
from core.utils import get_logger
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
console = Console()
|
||||
log = utils.get_logger("init")
|
||||
log = get_logger("init")
|
||||
|
||||
log.info("Hello from KuiToi-Server!")
|
||||
args = parser.parse_args()
|
||||
@ -40,17 +43,18 @@ config_path = "kuitoi.yml"
|
||||
if args.config:
|
||||
config_path = args.config
|
||||
log.info(f"Use {config_path} for config.")
|
||||
|
||||
config_provider = ConfigProvider(config_path)
|
||||
config = config_provider.open_config()
|
||||
if config.Server['debug'] is True:
|
||||
utils.set_debug_status()
|
||||
core.utils.set_debug_status()
|
||||
log.info("Getting new logging with DEBUG level!")
|
||||
log = utils.get_logger("main")
|
||||
log = get_logger("main")
|
||||
log.debug("Debug mode enabled!")
|
||||
log.debug(f"Server config: {config}")
|
||||
console.builtins_hook()
|
||||
console.logger_hook()
|
||||
console.add_command("stop", console.stop, "stop - Just shutting down the server.\nUsage: stop", "Server shutdown.")
|
||||
console.add_command("exit", console.stop, "stop - Just shutting down the server.\nUsage: stop", "Server shutdown.")
|
||||
|
||||
if not os.path.exists("mods"):
|
||||
os.mkdir("mods")
|
||||
|
@ -13,8 +13,19 @@ log = utils.get_logger("core")
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
|
||||
async def main():
|
||||
log.info("Server started!")
|
||||
while True:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
|
||||
async def astart():
|
||||
tasks = [console.start(), main()]
|
||||
await asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION)
|
||||
|
||||
|
||||
def start():
|
||||
log.info("Start!")
|
||||
asyncio.run(astart())
|
||||
|
||||
|
||||
def stop():
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Developed by KuiToi Dev
|
||||
# File main.py
|
||||
# Written by: SantaSpeen
|
||||
# Version 0.1.0
|
||||
# Version 1.0
|
||||
# Licence: FPA
|
||||
# (c) kuitoi.su 2023
|
||||
import argparse
|
||||
@ -18,7 +18,7 @@ if __name__ == '__main__':
|
||||
try:
|
||||
core.start()
|
||||
except KeyboardInterrupt:
|
||||
print("Exiting..")
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
core.stop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user