-
Notifications
You must be signed in to change notification settings - Fork 36
Plugins changes #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins changes #178
Conversation
Also updated __init__ method
plugin_exists() now checks for the existance of the plugin's main file.
I'm not sure if this is completely done, or if you have more to do with it, so I won't merge it in. For my testing, everything works great, and I really like the changes. It did take me a bit to modify GunGame to get it working, since GunGame inherits from all of these classes, but I did manage it. The only thing I would change is to move calling the plugin (un)loaded listeners calls to their own methods that can be overwritten. It's not a huge deal, but for GunGame specifically, I would rather call and listen for events (gg_plugin_(un)loaded) than have a listener that is called for each and every plugin (un)loaded by SP or any other inheriting plugins. I can manage this myself by adding those calls elsewhere (which I have for the time being), but it would be more convenient to just overwrite the PluginManager.notify_(un)load methods. |
Updated OnPluginUnloaded listener.
Yes, this was meant to be in a merge-able state. After your last statement I reconsidered the listeners you mentioned, but came to the conclusion that they shouldn't be overwritten. Otherwise the listeners would have inconsistent behaviour, because some sub-plugins are firing it and some aren't. The best you can do is something like this: from listeners import OnPluginLoaded
from listeners import OnPluginUnloaded
@OnPluginLoaded
def on_plugin_loaded(plugin):
if plugin.manager is not gg_plugin_manager:
return
# Fire gg_plugin_loaded event here...
@OnPluginUnloaded
def on_plugin_unloaded(plugin):
if plugin.manager is not gg_plugin_manager:
return
# Fire gg_plugin_unloaded event here... |
Yeah, that makes sense to not overwrite. I'm handling it differently than that, though, as there is no need to even have that check if I fire my event right after the plugins (un)load anyway. |
Uh oh!
There was an error while loading. Please reload this page.