fix: 插件执行时不正确的逻辑

This commit is contained in:
Rock Chin
2023-02-25 20:29:21 +08:00
parent 5044f757fb
commit 28d1f5ead9
3 changed files with 24 additions and 9 deletions

View File

@@ -158,6 +158,7 @@ class Plugin:
:return:
None
"""
global __current_registering_plugin__
def wrapper(func):
plugin_hooks = host.__plugins__[__current_registering_plugin__]["hooks"]
@@ -166,6 +167,8 @@ class Plugin:
plugin_hooks[event] = []
plugin_hooks[event].append(func)
# print("registering hook: p='{}', e='{}', f={}".format(__current_registering_plugin__, event, func))
host.__plugins__[__current_registering_plugin__]["hooks"] = plugin_hooks
return func
@@ -188,7 +191,6 @@ def register(name: str, description: str, version: str, author: str):
global __current_registering_plugin__
__current_registering_plugin__ = name
# print("registering plugin: n='{}', d='{}', v={}, a='{}'".format(name, description, version, author))
host.__plugins__[name] = {
"name": name,