Commit 56e412fe authored by nanahira's avatar nanahira

add dupe register check

parent bcea58d2
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
KoishiServiceProvideSym, KoishiServiceProvideSym,
KoishiSystemInjectSym, KoishiSystemInjectSym,
KoishiSystemInjectSymKeys, KoishiSystemInjectSymKeys,
ThirdEyeSym,
} from './def'; } from './def';
import { reflector } from './meta/meta-fetch'; import { reflector } from './meta/meta-fetch';
import { SchemaClass } from 'schemastery-gen'; import { SchemaClass } from 'schemastery-gen';
...@@ -62,6 +63,9 @@ export function DefinePlugin<T = any>( ...@@ -62,6 +63,9 @@ export function DefinePlugin<T = any>(
if (options.using) { if (options.using) {
UsingService(...options.using)(originalClass); UsingService(...options.using)(originalClass);
} }
if (originalClass[ThirdEyeSym]) {
return originalClass;
}
const newClass = class extends originalClass implements PluginClass { const newClass = class extends originalClass implements PluginClass {
static get Config() { static get Config() {
const schemaType = const schemaType =
...@@ -243,6 +247,7 @@ export function DefinePlugin<T = any>( ...@@ -243,6 +247,7 @@ export function DefinePlugin<T = any>(
reflector.get('KoishiPredefineName', originalClass) || reflector.get('KoishiPredefineName', originalClass) ||
originalClass.name, originalClass.name,
}); });
newClass[ThirdEyeSym] = true;
return newClass; return newClass;
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment