blob: ae67f4f0b4014b46133916be544182ddf0d45646 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import Plugins from "plugins";
import { Settings } from "../api/settings";
import Logger from "../utils/logger";
import { Patch } from "../utils/types";
const logger = new Logger("PluginManager", "#a6d189");
export const plugins = Plugins;
export const patches = [] as Patch[];
for (const plugin of Plugins) if (plugin.patches && Settings.plugins[plugin.name].enabled) {
for (const patch of plugin.patches) {
patch.plugin = plugin.name;
if (!Array.isArray(patch.replacement)) patch.replacement = [patch.replacement];
patches.push(patch);
}
}
export function startAll() {
for (const plugin of plugins) if (plugin.start && Settings.plugins[plugin.name].enabled) {
try {
logger.info("Starting plugin", plugin.name);
plugin.start();
} catch (err) {
logger.error("Failed to start plugin", plugin.name, err);
}
}
}
|