Introduce AbstractJvmPlugin

This commit is contained in:
Him188 2020-06-24 04:31:24 +08:00
parent b5b3df4075
commit 1186083f09
4 changed files with 33 additions and 5 deletions

View File

@ -0,0 +1,28 @@
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "EXPOSED_SUPER_CLASS")
package net.mamoe.mirai.console.plugin.jvm
import net.mamoe.mirai.console.plugin.internal.JvmPluginImpl
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
/**
* [JavaPlugin] [KotlinPlugin] 的父类
*
* @see JavaPlugin
* @see KotlinPlugin
*/
abstract class AbstractJvmPlugin @JvmOverloads constructor(
parentCoroutineContext: CoroutineContext = EmptyCoroutineContext
) : JvmPlugin, JvmPluginImpl(parentCoroutineContext) {
// TODO: 2020/6/24 添加 PluginSetting 继承 Setting, 实现 onValueChanged 并绑定自动保存.
}

View File

@ -11,7 +11,6 @@
package net.mamoe.mirai.console.plugin.jvm
import net.mamoe.mirai.console.plugin.internal.JvmPluginImpl
import net.mamoe.mirai.console.utils.JavaPluginScheduler
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
@ -21,7 +20,7 @@ import kotlin.coroutines.EmptyCoroutineContext
*/
abstract class JavaPlugin @JvmOverloads constructor(
parentCoroutineContext: CoroutineContext = EmptyCoroutineContext
) : JvmPlugin, JvmPluginImpl(parentCoroutineContext) {
) : JvmPlugin, AbstractJvmPlugin(parentCoroutineContext) {
/**
* Java API Scheduler

View File

@ -17,7 +17,9 @@ import net.mamoe.mirai.utils.MiraiLogger
/**
* Java Kotlin Jar 插件
* Java, Kotlin 或其他 JVM 平台插件
*
* @see AbstractJvmPlugin 默认实现
*
* @see JavaPlugin Java 插件
* @see KotlinPlugin Kotlin 插件

View File

@ -11,7 +11,6 @@
package net.mamoe.mirai.console.plugin.jvm
import net.mamoe.mirai.console.plugin.internal.JvmPluginImpl
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
@ -20,4 +19,4 @@ import kotlin.coroutines.EmptyCoroutineContext
*/
abstract class KotlinPlugin @JvmOverloads constructor(
parentCoroutineContext: CoroutineContext = EmptyCoroutineContext
) : JvmPlugin, JvmPluginImpl(parentCoroutineContext)
) : JvmPlugin, AbstractJvmPlugin(parentCoroutineContext)