This commit is contained in:
Maxim Khomutov 2023-07-05 17:47:59 +03:00
parent 56c1da1134
commit 4d8cd4e559
3 changed files with 9 additions and 13 deletions

View File

@ -9,7 +9,7 @@ __title__ = 'KuiToi-Server'
__description__ = 'BeamingDrive Multiplayer server compatible with BeamMP clients.'
__url__ = 'https://github.com/kuitoi/kuitoi-Server'
__version__ = '0.1.3'
__build__ = 214
__build__ = 218
__author__ = 'SantaSpeen'
__author_email__ = 'admin@kuitoi.su'
__license__ = "FPA"
@ -64,13 +64,6 @@ log.info(i18n.hello)
ev = EventsSystem()
ev.builtins_hook()
if not os.path.exists("plugins"):
os.mkdir("plugins")
pl = PluginsLoader("plugins")
pl.load_plugins()
ev.call_event("on_starting")
# Key handler..
if not config.Auth['key']:
log.warn("Key needed for starting the server!")
@ -101,5 +94,11 @@ console.add_command("exit", console.stop, "stop - Just shutting down the server.
if not os.path.exists("mods"):
os.mkdir("mods")
if not os.path.exists("plugins"):
os.mkdir("plugins")
pl = PluginsLoader("plugins")
pl.load_plugins()
ev.call_event("on_started")
log.info(i18n.init)

View File

@ -7,7 +7,6 @@ class EventsSystem:
def __init__(self):
self.__events = {
"on_starting": [self.on_starting],
"on_started": [self.on_started],
"on_stop": [self.on_stop],
"on_auth": [self.on_auth]
@ -36,9 +35,6 @@ class EventsSystem:
else:
self.log.warning(f"Event {event_name} does not exist. Just skipping it...")
def on_starting(self):
pass
def on_started(self):
pass

View File

@ -9,7 +9,7 @@ class BEAMP:
def __init__(self, name=None):
if name is None:
raise Exception("BEAMP: Name is required")
self.log = get_logger(f"BEAMP({name})")
self.log = get_logger(f"PluginsLoader | {name}")
self.name = name
def set_name(self, name):
@ -41,6 +41,7 @@ class PluginsLoader:
self.log.debug(f"Loading plugin: {file}")
plugin = types.ModuleType('plugin')
plugin.BEAMP = BEAMP
plugin.print = print
file = os.path.join(self.__plugins_dir, file)
with open(f'{file}', 'r') as f:
code = f.read().replace("import BEAMP\n", "")