diff --git a/mirai-console/backend/mirai-console/src/internal/plugin/JvmPluginInternal.kt b/mirai-console/backend/mirai-console/src/internal/plugin/JvmPluginInternal.kt index ad27e484d7..9e2960aa2c 100644 --- a/mirai-console/backend/mirai-console/src/internal/plugin/JvmPluginInternal.kt +++ b/mirai-console/backend/mirai-console/src/internal/plugin/JvmPluginInternal.kt @@ -126,7 +126,12 @@ internal abstract class JvmPluginInternal( parentPermission if (!firstRun) refreshCoroutineContext() - val except = javaClass.getDeclaredAnnotation(ConsoleJvmPluginFuncCallbackStatusExcept.OnEnable::class.java) + val except = try { + javaClass.getDeclaredAnnotation(ConsoleJvmPluginFuncCallbackStatusExcept.OnEnable::class.java) + }catch(e: Throwable){ + null + } + kotlin.runCatching { onEnable() }.fold( @@ -244,4 +249,4 @@ internal inline fun AtomicLong.updateWhen(condition: (Long) -> Boolean, update: } } -internal val Throwable.rootCauseOrSelf: Throwable get() = generateSequence(this) { it.cause }.lastOrNull() ?: this \ No newline at end of file +internal val Throwable.rootCauseOrSelf: Throwable get() = generateSequence(this) { it.cause }.lastOrNull() ?: this