2020-05-02 16:14:47 +00:00
|
|
|
import i18n from '@ccms/i18n'
|
2020-10-13 01:24:58 +00:00
|
|
|
import { plugin, server } from '@ccms/api'
|
|
|
|
import { provideSingleton, Container, ContainerInstance, Autowired } from '@ccms/container'
|
2019-09-07 04:23:15 +00:00
|
|
|
|
2020-07-06 08:06:47 +00:00
|
|
|
import './config'
|
2019-11-05 09:03:49 +00:00
|
|
|
import { interfaces } from './interfaces'
|
2020-09-22 10:42:39 +00:00
|
|
|
import { PluginTaskManager } from './task'
|
2020-07-06 08:06:47 +00:00
|
|
|
import { PluginEventManager } from './event'
|
2020-09-22 10:42:39 +00:00
|
|
|
import { PluginCommandManager } from './command'
|
2020-09-24 10:36:10 +00:00
|
|
|
import { PluginConfigManager } from './config'
|
2019-09-07 04:23:15 +00:00
|
|
|
|
2020-04-24 07:38:00 +00:00
|
|
|
const Thread = Java.type('java.lang.Thread')
|
|
|
|
|
2020-02-26 02:15:33 +00:00
|
|
|
@provideSingleton(plugin.PluginManager)
|
2019-09-07 04:23:15 +00:00
|
|
|
export class PluginManagerImpl implements plugin.PluginManager {
|
2020-10-13 01:24:58 +00:00
|
|
|
@Autowired(ContainerInstance)
|
2020-01-17 03:11:20 +00:00
|
|
|
private container: Container
|
2020-10-13 01:24:58 +00:00
|
|
|
@Autowired(plugin.PluginInstance)
|
2019-11-05 09:03:49 +00:00
|
|
|
private pluginInstance: any
|
2020-10-13 01:24:58 +00:00
|
|
|
@Autowired(server.ServerType)
|
2019-11-05 09:03:49 +00:00
|
|
|
private serverType: string
|
2020-09-24 10:36:10 +00:00
|
|
|
|
|
|
|
@Autowired()
|
2020-09-17 09:44:48 +00:00
|
|
|
private serverChecker: server.ServerChecker
|
2020-10-13 01:24:58 +00:00
|
|
|
@Autowired()
|
|
|
|
private nativePluginManager: server.NativePluginManager
|
2019-09-07 04:23:15 +00:00
|
|
|
|
2020-09-24 10:36:10 +00:00
|
|
|
@Autowired()
|
2020-09-22 10:42:39 +00:00
|
|
|
private taskManager: PluginTaskManager
|
2020-09-24 10:36:10 +00:00
|
|
|
@Autowired()
|
2020-07-06 08:06:47 +00:00
|
|
|
private eventManager: PluginEventManager
|
2020-09-24 10:36:10 +00:00
|
|
|
@Autowired()
|
|
|
|
private configManager: PluginConfigManager
|
|
|
|
@Autowired()
|
2020-09-22 10:42:39 +00:00
|
|
|
private commandManager: PluginCommandManager
|
2020-07-06 08:06:47 +00:00
|
|
|
|
2020-04-24 07:38:00 +00:00
|
|
|
private initialized: boolean = false
|
2020-06-17 10:39:24 +00:00
|
|
|
|
|
|
|
private sacnnerMap: Map<string, plugin.PluginScanner>
|
|
|
|
private loaderMap: Map<string, plugin.PluginLoader>
|
|
|
|
|
|
|
|
private instanceMap: Map<string, plugin.Plugin>
|
|
|
|
private metadataMap: Map<string, plugin.PluginMetadata>
|
2021-06-22 07:51:13 +00:00
|
|
|
/**
|
|
|
|
* 延时加载插件
|
|
|
|
*/
|
|
|
|
private lazyMetadataMap: Map<string, plugin.PluginMetadata>
|
2020-06-17 10:39:24 +00:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.sacnnerMap = new Map()
|
|
|
|
this.loaderMap = new Map()
|
|
|
|
|
|
|
|
this.instanceMap = new Map()
|
|
|
|
this.metadataMap = new Map()
|
2021-06-22 07:51:13 +00:00
|
|
|
this.lazyMetadataMap = new Map()
|
2020-07-06 08:06:47 +00:00
|
|
|
|
|
|
|
// ignore unused
|
2020-09-22 10:42:39 +00:00
|
|
|
this.taskManager
|
2020-07-06 08:06:47 +00:00
|
|
|
this.eventManager
|
2020-09-24 10:36:10 +00:00
|
|
|
this.configManager
|
2020-09-22 10:42:39 +00:00
|
|
|
this.commandManager
|
2020-06-17 10:39:24 +00:00
|
|
|
}
|
2019-09-07 04:23:15 +00:00
|
|
|
|
2020-01-31 18:46:55 +00:00
|
|
|
initialize() {
|
2020-05-26 07:53:41 +00:00
|
|
|
if (this.pluginInstance === undefined) { throw new Error("Can't found Plugin Instance!") }
|
|
|
|
if (this.initialized !== true) {
|
2022-04-19 01:29:57 +00:00
|
|
|
process.emit('plugin.manager.before.initialize', this)
|
2020-04-24 07:38:00 +00:00
|
|
|
console.i18n('ms.plugin.initialize', { plugin: this.pluginInstance, loader: Thread.currentThread().contextClassLoader })
|
2022-04-19 01:29:57 +00:00
|
|
|
try {
|
|
|
|
console.i18n('ms.plugin.event.map', { count: this.eventManager.mapEventName(), type: this.serverType })
|
|
|
|
} catch (error) {
|
|
|
|
console.i18n('ms.plugin.event.map.error', { error })
|
|
|
|
}
|
2020-06-17 10:39:24 +00:00
|
|
|
let pluginScanner = this.container.getAll<plugin.PluginScanner>(plugin.PluginScanner)
|
|
|
|
pluginScanner.forEach((scanner) => {
|
|
|
|
console.debug(`loading plugin sacnner ${scanner.type}...`)
|
|
|
|
this.sacnnerMap.set(scanner.type, scanner)
|
|
|
|
})
|
|
|
|
let pluginLoaders = this.container.getAll<plugin.PluginLoader>(plugin.PluginLoader)
|
|
|
|
pluginLoaders.forEach((loader) => {
|
|
|
|
console.debug(`loading plugin loader ${loader.type}...`)
|
|
|
|
this.loaderMap.set(loader.type, loader)
|
|
|
|
})
|
2020-05-15 06:28:40 +00:00
|
|
|
this.initialized = true
|
2022-04-19 01:29:57 +00:00
|
|
|
process.emit('plugin.manager.after.initialize', this)
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
scan(folder: string): void {
|
2020-06-17 10:39:24 +00:00
|
|
|
if (!folder) { throw new Error('plugin scan folder can\'t be empty!') }
|
2020-04-24 07:38:00 +00:00
|
|
|
this.initialize()
|
2022-04-19 01:29:57 +00:00
|
|
|
process.emit('plugin.manager.before.scan', folder, this)
|
2020-06-17 10:39:24 +00:00
|
|
|
for (const [, scanner] of this.sacnnerMap) {
|
|
|
|
try {
|
2020-12-17 08:58:37 +00:00
|
|
|
console.i18n('ms.plugin.manager.scan', { scanner: scanner.type, folder })
|
|
|
|
let plugins = scanner.scan(folder)
|
|
|
|
console.i18n('ms.plugin.manager.scan.finish', { scanner: scanner.type, folder, size: plugins.length })
|
|
|
|
plugins.forEach(loadMetadata => {
|
2020-06-23 07:51:55 +00:00
|
|
|
try {
|
2020-12-17 08:58:37 +00:00
|
|
|
this.loadAndRequirePlugin(loadMetadata)
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (error: any) {
|
2020-09-17 09:44:48 +00:00
|
|
|
console.error(`plugin scanner ${scanner.type} load ${loadMetadata.file} occurred error ${error}`)
|
2020-06-23 07:51:55 +00:00
|
|
|
console.ex(error)
|
|
|
|
}
|
2020-06-17 10:39:24 +00:00
|
|
|
})
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (error: any) {
|
2020-06-17 10:39:24 +00:00
|
|
|
console.error(`plugin scanner ${scanner.type} occurred error ${error}`)
|
|
|
|
console.ex(error)
|
|
|
|
}
|
|
|
|
}
|
2022-04-19 01:29:57 +00:00
|
|
|
process.emit('plugin.manager.after.scan', folder, this)
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
|
|
|
|
2020-01-17 03:11:20 +00:00
|
|
|
build(): void {
|
2022-04-19 01:29:57 +00:00
|
|
|
process.emit('plugin.manager.before.build', this)
|
2020-01-17 03:11:20 +00:00
|
|
|
this.buildPlugins()
|
2022-04-19 01:29:57 +00:00
|
|
|
process.emit('plugin.manager.after.build', this)
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
|
|
|
|
2020-06-02 10:01:56 +00:00
|
|
|
private logStage(plugin: plugin.Plugin, stage: string) {
|
2020-02-27 04:11:18 +00:00
|
|
|
console.i18n("ms.plugin.manager.stage", { stage, plugin: plugin.description.name, version: plugin.description.version, author: plugin.description.author })
|
2020-01-31 18:46:55 +00:00
|
|
|
}
|
|
|
|
|
2020-07-06 08:06:47 +00:00
|
|
|
private runPluginStage(plugin: plugin.Plugin, stage: string) {
|
2020-06-17 10:39:24 +00:00
|
|
|
if (!plugin) { throw new Error(`can't run runPluginStage ${stage} because plugin is ${plugin}`) }
|
2020-06-02 10:01:56 +00:00
|
|
|
try {
|
|
|
|
this.logStage(plugin, i18n.translate(`ms.plugin.manager.stage.${stage}`))
|
2020-07-06 08:06:47 +00:00
|
|
|
process.emit(`plugin.before.${stage}`, plugin)
|
2020-06-02 10:01:56 +00:00
|
|
|
this.runCatch(plugin, stage)
|
|
|
|
this.runCatch(plugin, `${this.serverType}${stage}`)
|
2020-09-17 09:44:48 +00:00
|
|
|
plugin.description.loadMetadata.loader[stage]?.(plugin)
|
2020-07-06 08:06:47 +00:00
|
|
|
process.emit(`plugin.after.${stage}`, plugin)
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (ex: any) {
|
2020-06-02 10:01:56 +00:00
|
|
|
console.i18n("ms.plugin.manager.stage.exec.error", { plugin: plugin.description.name, executor: stage, error: ex })
|
2020-07-06 09:41:15 +00:00
|
|
|
if (global.debug) { console.ex(ex) }
|
2020-06-02 10:01:56 +00:00
|
|
|
}
|
2020-04-26 02:19:44 +00:00
|
|
|
}
|
|
|
|
|
2020-06-23 07:51:55 +00:00
|
|
|
private loadPlugin(loadMetadata: plugin.PluginLoadMetadata) {
|
2020-06-30 07:58:51 +00:00
|
|
|
if (!loadMetadata) { throw new Error('loadMetadata can\'t be undefiend when loadPlugin!') }
|
2020-09-17 09:44:48 +00:00
|
|
|
if (loadMetadata.loaded) { throw new Error(`Plugin file ${loadMetadata.file} is already loaded by ${loadMetadata.loader?.type}!`) }
|
2022-04-02 08:51:08 +00:00
|
|
|
process.emit(`plugin.before.require`, loadMetadata)
|
2020-06-17 10:39:24 +00:00
|
|
|
try {
|
|
|
|
for (const [, loader] of this.loaderMap) {
|
2020-07-06 08:06:47 +00:00
|
|
|
if (this.loaderRequirePlugin(loadMetadata, loader)?.loaded) return loadMetadata.metadata
|
2020-06-17 10:39:24 +00:00
|
|
|
}
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (error: any) {
|
2020-06-23 07:51:55 +00:00
|
|
|
console.i18n("ms.plugin.manager.initialize.error", { name: loadMetadata.file, ex: error })
|
2020-06-17 10:39:24 +00:00
|
|
|
console.ex(error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-06 08:06:47 +00:00
|
|
|
private loaderRequirePlugin(loadMetadata: plugin.PluginLoadMetadata, loader: plugin.PluginLoader) {
|
|
|
|
try {
|
|
|
|
if (loader.require(loadMetadata).loaded) {
|
|
|
|
loadMetadata.loader = loader
|
|
|
|
let metadata = loadMetadata.metadata
|
2020-09-22 10:42:39 +00:00
|
|
|
if (this.metadataMap.has(metadata.name) && this.instanceMap.has(metadata.name)) {
|
2020-07-23 05:44:55 +00:00
|
|
|
let oldMetadata = this.metadataMap.get(metadata.name)
|
|
|
|
throw new Error(`Plugin ${oldMetadata.name} is already load from ${oldMetadata.source}...`)
|
|
|
|
}
|
2020-07-06 08:06:47 +00:00
|
|
|
this.metadataMap.set(metadata.name, metadata)
|
|
|
|
metadata.loadMetadata = loadMetadata
|
2022-04-02 08:51:08 +00:00
|
|
|
process.emit(`plugin.after.require`, loadMetadata)
|
2020-07-06 08:06:47 +00:00
|
|
|
}
|
|
|
|
return loadMetadata
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (error: any) {
|
2020-07-06 08:06:47 +00:00
|
|
|
if (global.debug) {
|
|
|
|
console.console(`§6Loader §b${loader.type} §6load §a${loadMetadata.file} §cerror. §4Err: §c${error}`)
|
|
|
|
console.ex(error)
|
|
|
|
} else {
|
|
|
|
console.warn(`Loader ${loader.type} load ${loadMetadata.file} error. Err: ${error}`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-17 08:58:37 +00:00
|
|
|
private loadAndRequirePlugin(loadMetadata: plugin.PluginLoadMetadata) {
|
|
|
|
let startTime = Date.now()
|
|
|
|
let metadata = this.loadPlugin(loadMetadata.scanner.load(loadMetadata))
|
2022-04-01 09:18:32 +00:00
|
|
|
if (!metadata) { throw new Error('load plugin metadata failed.') }
|
2020-12-17 08:58:37 +00:00
|
|
|
console.i18n('ms.plugin.manager.build', {
|
|
|
|
name: loadMetadata.metadata.name,
|
|
|
|
version: loadMetadata.metadata.version,
|
|
|
|
file: loadMetadata.file.toString().replace(root, ''),
|
|
|
|
scanner: loadMetadata.scanner.type,
|
|
|
|
loader: loadMetadata.loader.type,
|
|
|
|
cost: (Date.now() - startTime) / 1000
|
|
|
|
})
|
|
|
|
return metadata
|
|
|
|
}
|
|
|
|
|
2020-05-07 10:33:10 +00:00
|
|
|
/**
|
|
|
|
* 从文件加载插件
|
|
|
|
* @param file java.io.File
|
|
|
|
*/
|
2022-04-01 09:18:32 +00:00
|
|
|
loadFromFile(file: string, ext: any = 'js'): plugin.Plugin {
|
|
|
|
if (!file) { throw new Error('plugin file can\'t be undefiend.') }
|
|
|
|
let scanner = this.sacnnerMap.get(ext)
|
|
|
|
if (!scanner) { throw new Error(`plugin scanner ${ext} can't found in sacnnerMap.`) }
|
2020-12-17 08:58:37 +00:00
|
|
|
let metadata = this.loadAndRequirePlugin(scanner.read(file))
|
2022-04-19 01:29:57 +00:00
|
|
|
this.buildPlugin(metadata)
|
|
|
|
let plugin = metadata.target
|
|
|
|
if (!plugin) { throw new Error(`plugin scanner ${ext} can't found in sacnnerMap.`) }
|
2020-05-07 09:12:15 +00:00
|
|
|
this.load(plugin)
|
|
|
|
this.enable(plugin)
|
2020-05-15 06:28:40 +00:00
|
|
|
return plugin
|
2020-05-07 09:12:15 +00:00
|
|
|
}
|
|
|
|
|
2019-09-19 10:59:32 +00:00
|
|
|
load(...args: any[]): void {
|
2020-07-06 08:06:47 +00:00
|
|
|
this.checkAndGet(args[0]).forEach((plugin: plugin.Plugin) => this.runPluginStage(plugin, 'load'))
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
|
|
|
|
2019-09-19 10:59:32 +00:00
|
|
|
enable(...args: any[]): void {
|
2020-07-06 08:06:47 +00:00
|
|
|
this.checkAndGet(args[0]).forEach((plugin: plugin.Plugin) => this.runPluginStage(plugin, 'enable'))
|
2019-09-19 10:59:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
disable(...args: any[]): void {
|
2020-07-23 05:44:55 +00:00
|
|
|
this.checkAndGet(args[0]).forEach((plugin: plugin.Plugin) => {
|
|
|
|
this.runPluginStage(plugin, 'disable')
|
|
|
|
this.metadataMap.delete(plugin.description.name)
|
|
|
|
this.instanceMap.delete(plugin.description.name)
|
|
|
|
})
|
2019-09-19 10:59:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
reload(...args: any[]): void {
|
2020-06-02 10:01:56 +00:00
|
|
|
this.checkAndGet(args[0]).forEach((pl: plugin.Plugin) => {
|
2019-11-05 09:03:49 +00:00
|
|
|
this.disable(pl)
|
2022-04-01 09:18:32 +00:00
|
|
|
this.loadFromFile(pl.description.loadMetadata.file, pl.description.loadMetadata.scanner.type)
|
2019-09-19 10:59:32 +00:00
|
|
|
})
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
|
|
|
|
2020-06-02 10:01:56 +00:00
|
|
|
getPlugin(name: string) {
|
2020-06-17 10:39:24 +00:00
|
|
|
return this.instanceMap.get(name)
|
2020-06-02 10:01:56 +00:00
|
|
|
}
|
|
|
|
|
2019-09-22 10:00:18 +00:00
|
|
|
getPlugins() {
|
2020-06-17 10:39:24 +00:00
|
|
|
return this.instanceMap
|
2019-09-22 10:00:18 +00:00
|
|
|
}
|
|
|
|
|
2019-09-07 04:23:15 +00:00
|
|
|
private runCatch(pl: any, func: string) {
|
|
|
|
try {
|
2019-11-05 09:03:49 +00:00
|
|
|
if (pl[func]) pl[func].call(pl)
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (ex: any) {
|
2020-04-26 02:19:44 +00:00
|
|
|
console.i18n("ms.plugin.manager.stage.exec.error", { plugin: pl.description.name, executor: func, error: ex })
|
2019-11-05 09:03:49 +00:00
|
|
|
console.ex(ex)
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-02 10:01:56 +00:00
|
|
|
private checkAndGet(name: string | plugin.Plugin | undefined | any): Map<string, plugin.Plugin> | plugin.Plugin[] {
|
2022-04-01 09:18:32 +00:00
|
|
|
if (name === undefined) throw new Error(`checkAndGet Plugin can't be undefiend.`)
|
2020-06-17 10:39:24 +00:00
|
|
|
if (name == this.instanceMap) { return this.instanceMap }
|
|
|
|
if (typeof name == 'string' && this.instanceMap.has(name)) { return [this.instanceMap.get(name)] }
|
2020-06-02 10:01:56 +00:00
|
|
|
if (name instanceof interfaces.Plugin) { return [name as plugin.Plugin] }
|
2020-06-30 07:58:51 +00:00
|
|
|
if (name.description?.name) { return [name as plugin.Plugin] }
|
2022-04-01 09:18:32 +00:00
|
|
|
throw new Error(`Plugin ${JSON.stringify(name)} not exist.`)
|
2019-09-19 10:59:32 +00:00
|
|
|
}
|
|
|
|
|
2020-01-17 03:11:20 +00:00
|
|
|
private buildPlugins() {
|
2021-06-22 07:51:13 +00:00
|
|
|
this.metadataMap.forEach((metadata, key) => {
|
|
|
|
if (metadata?.depends?.length) {
|
|
|
|
this.lazyMetadataMap.set(key, metadata)
|
|
|
|
} else {
|
2022-04-19 01:29:57 +00:00
|
|
|
this.tryBuildPlugin(metadata)
|
2019-09-19 10:59:32 +00:00
|
|
|
}
|
2020-07-23 05:44:55 +00:00
|
|
|
})
|
2022-04-19 01:29:57 +00:00
|
|
|
this.lazyMetadataMap.forEach((metadata, key) => this.tryBuildPlugin(metadata))
|
2020-07-23 05:44:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 01:24:58 +00:00
|
|
|
private checkDepends(depends: string | string[]) {
|
2020-12-07 03:12:49 +00:00
|
|
|
if (!depends) return []
|
|
|
|
let loseDepends = []
|
|
|
|
for (const depend of depends) { if (!this.metadataMap.has(depend)) loseDepends.push(depend) }
|
|
|
|
return loseDepends
|
2020-10-13 01:24:58 +00:00
|
|
|
}
|
|
|
|
private checkNativeDepends(depends: string | string[]) {
|
2020-12-07 03:12:49 +00:00
|
|
|
if (!depends) return []
|
|
|
|
let loseDepends = []
|
|
|
|
for (const depend of depends) { if (!this.nativePluginManager.has(depend)) loseDepends.push(depend) }
|
|
|
|
return loseDepends
|
2020-10-13 01:24:58 +00:00
|
|
|
}
|
2022-04-19 01:29:57 +00:00
|
|
|
|
|
|
|
private tryBuildPlugin(metadata: plugin.PluginMetadata) {
|
2021-06-22 07:51:13 +00:00
|
|
|
try {
|
2022-04-19 01:29:57 +00:00
|
|
|
return this.buildPlugin(metadata)
|
2021-12-25 17:21:06 +00:00
|
|
|
} catch (error: any) {
|
2021-06-22 07:51:13 +00:00
|
|
|
console.console(`§4无法加载插件 §b${metadata.name} §4构建插件失败!`)
|
|
|
|
console.ex(error)
|
|
|
|
}
|
2019-09-19 10:59:32 +00:00
|
|
|
}
|
2022-04-19 01:29:57 +00:00
|
|
|
|
|
|
|
private buildPlugin(metadata: plugin.PluginMetadata) {
|
|
|
|
process.emit(`plugin.before.build`, metadata)
|
|
|
|
if (this.instanceMap.has(metadata.name)) { throw new Error(`Plugin ${metadata.name} is already load from ${metadata.source}...`) }
|
|
|
|
if (!this.loaderMap.has(metadata.type)) { throw new Error(`§4无法加载插件 §b${metadata.name} §4请检查 §c${metadata.type} §4加载器是否正常启用!`) }
|
|
|
|
if (!this.serverChecker.check(metadata.servers)) { throw new Error(`§6插件 §b${metadata.name} §c服务器类型不兼容(${metadata.servers.join(',')}) §6忽略加载...`) }
|
|
|
|
let loseDepends = this.checkDepends(metadata.depends) || []
|
|
|
|
if (loseDepends.length) { throw new Error(`§4无法加载插件 §b${metadata.name} §4请检查脚本依赖 §3[${loseDepends.join(',')}] §4是否安装完整!`) }
|
|
|
|
let loseNativeDepends = this.checkNativeDepends(metadata.nativeDepends) || []
|
|
|
|
if (loseNativeDepends.length) { throw new Error(`§4无法加载插件 §b${metadata.name} §4请检查插件依赖 §3[${loseNativeDepends.join(',')}] §4是否安装完整!`) }
|
|
|
|
let pluginInstance = this.loaderMap.get(metadata.type).build(metadata)
|
|
|
|
if (!pluginInstance) { throw new Error(`§4加载器 §c${metadata.type} §4加载插件 §c${metadata.name} §4失败!`) }
|
|
|
|
metadata.target = pluginInstance
|
|
|
|
this.instanceMap.set(metadata.name, pluginInstance)
|
|
|
|
process.emit(`plugin.after.build`, metadata, pluginInstance)
|
|
|
|
return pluginInstance
|
|
|
|
}
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|