diff --git a/src/core/__init__.py b/src/core/__init__.py index b7c1816..acdd31e 100644 --- a/src/core/__init__.py +++ b/src/core/__init__.py @@ -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) diff --git a/src/modules/EventsSystem/events_system.py b/src/modules/EventsSystem/events_system.py index 196e244..8838947 100644 --- a/src/modules/EventsSystem/events_system.py +++ b/src/modules/EventsSystem/events_system.py @@ -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 diff --git a/src/modules/PluginsLoader/plugins_loader.py b/src/modules/PluginsLoader/plugins_loader.py index 2c65974..2a76c3a 100644 --- a/src/modules/PluginsLoader/plugins_loader.py +++ b/src/modules/PluginsLoader/plugins_loader.py @@ -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", "")