From 669d4bf56266f00f23b0acb7c28e914c7aba8a4b Mon Sep 17 00:00:00 2001 From: _Lighty_ Date: Tue, 18 Feb 2020 14:51:31 +0100 Subject: [PATCH] XL misc on load changes --- Plugins/1XenoLib.plugin.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Plugins/1XenoLib.plugin.js b/Plugins/1XenoLib.plugin.js index c9f956a..097c0ad 100644 --- a/Plugins/1XenoLib.plugin.js +++ b/Plugins/1XenoLib.plugin.js @@ -1278,17 +1278,7 @@ var XenoLib = (() => { /* NOTIFICATIONS END */ global.XenoLib = XenoLib; - const listener = e => { - if (e !== 'XenoLib') return; - XenoLib.shutdown(); - BDEvents.off('plugin-unloaded', listener); - }; - if (global.BDEvents) { - BDEvents.dispatch('xenolib-loaded'); - BDEvents.on('plugin-unloaded', listener); - } - - XenoLib.changeName(__filename, '1XenoLib'); /* prevent user from changing libs filename */ + let listener = DiscordConstants.NOOP; const notifLocations = ['topLeft', 'topMiddle', 'topRight', 'bottomLeft', 'bottomMiddle', 'bottomRight']; const notifLocationClasses = [`${XenoLib.getClass('selected topLeft')} ${XenoLib.getClass('topLeft option')}`, `topMiddle-xenoLib ${XenoLib.getClass('topLeft option')}`, `${XenoLib.getClass('selected topRight')} ${XenoLib.getClass('topLeft option')}`, `${XenoLib.getClass('selected bottomLeft')} ${XenoLib.getClass('topLeft option')}`, `bottomMiddle-xenoLib ${XenoLib.getClass('topLeft option')}`, `${XenoLib.getClass('selected bottomRight')} ${XenoLib.getClass('topLeft option')}`]; @@ -1382,6 +1372,18 @@ var XenoLib = (() => { constructor() { super(); this.settings = LibrarySettings; + listener = e => { + if (e !== 'XenoLib') return; + XenoLib.shutdown(); + BDEvents.off('plugin-unloaded', listener); + }; + XenoLib.changeName(__filename, '1XenoLib'); /* prevent user from changing libs filename */ + } + load() { + if (global.BDEvents) { + BDEvents.dispatch('xenolib-loaded'); + BDEvents.on('plugin-unloaded', listener); + } } buildSetting(data) { if (data.type === 'position') {