Link handling should be working

This commit is contained in:
Core 2022-01-24 00:25:43 +00:00
parent 64f646e123
commit 5c7a05ff61
5 changed files with 155 additions and 147 deletions

View file

@ -34,6 +34,7 @@ export default class PluginHandler {
fs.readdirSync(this.userPluginsPath).forEach(file => {
if (file.endsWith('.ts') || file.endsWith('.js')) {
const plugin = require(path.join(this.userPluginsPath, file)).default;
file = file.replace('.ts', '').replace('.js', '');
if (plugins[file] || plugin in plugins) {
console.log(`[${plugin.name}] Plugin already loaded / Duplicate Class Name`);
} else {
@ -54,4 +55,10 @@ export default class PluginHandler {
}
}
public callPlugin(plugin: string, event: string, ...args: any[]) {
if (this.pluginsList[plugin][event]) {
this.pluginsList[plugin][event](...args);
}
}
}