mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Prepare for lua support;
Minor update;
This commit is contained in:
parent
8139cbf8bc
commit
744a7347a3
@ -33,20 +33,10 @@ class KuiToi:
|
|||||||
def name(self):
|
def name(self):
|
||||||
return self.__name
|
return self.__name
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value):
|
|
||||||
# You chell not pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dir(self):
|
def dir(self):
|
||||||
return self.__dir
|
return self.__dir
|
||||||
|
|
||||||
@dir.setter
|
|
||||||
def dir(self, value):
|
|
||||||
# You chell not pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def open(self, file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None):
|
def open(self, file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None):
|
||||||
path = os.path.join(self.__dir, file)
|
path = os.path.join(self.__dir, file)
|
||||||
@ -83,6 +73,7 @@ class PluginsLoader:
|
|||||||
self.loaded_str = "Plugins: "
|
self.loaded_str = "Plugins: "
|
||||||
ev.register_event("_plugins_start", self.start)
|
ev.register_event("_plugins_start", self.start)
|
||||||
ev.register_event("_plugins_unload", self.unload)
|
ev.register_event("_plugins_unload", self.unload)
|
||||||
|
ev.register_event("_plugins_get", lambda x: self.plugins)
|
||||||
console.add_command("plugins", lambda x: self.loaded_str[:-2])
|
console.add_command("plugins", lambda x: self.loaded_str[:-2])
|
||||||
console.add_command("pl", lambda x: self.loaded_str[:-2])
|
console.add_command("pl", lambda x: self.loaded_str[:-2])
|
||||||
|
|
||||||
@ -90,7 +81,7 @@ class PluginsLoader:
|
|||||||
self.log.debug("Loading plugins...")
|
self.log.debug("Loading plugins...")
|
||||||
files = os.listdir(self.plugins_dir)
|
files = os.listdir(self.plugins_dir)
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith(".py"):
|
if os.path.isfile(file) and file.endswith(".py"):
|
||||||
try:
|
try:
|
||||||
self.log.debug(f"Loading plugin: {file[:-3]}")
|
self.log.debug(f"Loading plugin: {file[:-3]}")
|
||||||
plugin = types.ModuleType(file[:-3])
|
plugin = types.ModuleType(file[:-3])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user