fix plugin reload call order

This commit is contained in:
Zack Rauen 2018-11-03 10:47:41 -04:00
parent 7b50ff3ca0
commit 25ec9d61f5
2 changed files with 3 additions and 5 deletions

View File

@ -1635,15 +1635,13 @@ PluginModule.prototype.reloadPlugin = function(filenameOrName) {
const enabled = pluginCookie[plugin];
if (enabled) this.stopPlugin(plugin, true);
const error = ContentManager.reloadContent(bdplugins[plugin].filename, "plugin");
if (enabled) {
if (bdplugins[plugin].plugin.load && typeof(bdplugins[plugin].plugin.load) == "function") bdplugins[plugin].plugin.load();
this.startPlugin(plugin, true);
}
if (error) {
if (settingsCookie["fork-ps-1"]) mainCore.showContentErrors({plugins: [error]});
if (settingsCookie["fork-ps-2"]) BdApi.showToast(`${plugin} could not be reloaded.`, {type: "error"});
return Utils.err(`${plugin} could not be reloaded.`, error);
}
if (bdplugins[plugin].plugin.load && typeof(bdplugins[plugin].plugin.load) == "function") bdplugins[plugin].plugin.load();
if (enabled) this.startPlugin(plugin, true);
if (settingsCookie["fork-ps-2"]) BdApi.showToast(`${plugin} v${bdplugins[plugin].plugin.getVersion()} was reloaded.`, {type: "success"});
BDEvents.dispatch("plugin-reloaded", plugin);
};

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long