Rename package plugins to plugin

This commit is contained in:
Him188 2020-05-25 16:32:14 +08:00
parent 4fc91adc5d
commit 3d53f7f7bc
15 changed files with 32 additions and 37 deletions

View File

@ -3,10 +3,10 @@ package net.mamoe.n;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import net.mamoe.mirai.console.command.*; import net.mamoe.mirai.console.command.*;
import net.mamoe.mirai.console.plugins.Config; import net.mamoe.mirai.console.plugin.Config;
import net.mamoe.mirai.console.plugins.ConfigSection; import net.mamoe.mirai.console.plugin.ConfigSection;
import net.mamoe.mirai.console.plugins.ConfigSectionFactory; import net.mamoe.mirai.console.plugin.ConfigSectionFactory;
import net.mamoe.mirai.console.plugins.PluginBase; import net.mamoe.mirai.console.plugin.PluginBase;
import net.mamoe.mirai.console.utils.Utils; import net.mamoe.mirai.console.utils.Utils;
import net.mamoe.mirai.message.GroupMessage; import net.mamoe.mirai.message.GroupMessage;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -13,8 +13,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.io.charsets.Charset import kotlinx.io.charsets.Charset
import net.mamoe.mirai.Bot import net.mamoe.mirai.Bot
import net.mamoe.mirai.console.plugins.PluginLoader import net.mamoe.mirai.console.plugin.PluginLoader
import net.mamoe.mirai.console.plugins.builtin.JarPluginLoader import net.mamoe.mirai.console.plugin.builtin.JarPluginLoader
import net.mamoe.mirai.utils.DefaultLogger import net.mamoe.mirai.utils.DefaultLogger
import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.MiraiExperimentalAPI
import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.MiraiLogger

View File

@ -13,7 +13,7 @@
package net.mamoe.mirai.console.command package net.mamoe.mirai.console.command
import kotlinx.atomicfu.locks.withLock import kotlinx.atomicfu.locks.withLock
import net.mamoe.mirai.console.plugins.Plugin import net.mamoe.mirai.console.plugin.Plugin
import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.MessageChain
import net.mamoe.mirai.message.data.SingleMessage import net.mamoe.mirai.message.data.SingleMessage

View File

@ -7,9 +7,9 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.plugins package net.mamoe.mirai.console.plugin
import net.mamoe.mirai.console.plugins.builtin.JvmPlugin import net.mamoe.mirai.console.plugin.builtin.JvmPlugin
/** /**
* 表示一个 mirai-console 插件. * 表示一个 mirai-console 插件.

View File

@ -9,7 +9,7 @@
@file:Suppress("unused") @file:Suppress("unused")
package net.mamoe.mirai.console.plugins package net.mamoe.mirai.console.plugin
import java.io.File import java.io.File

View File

@ -9,7 +9,7 @@
@file:Suppress("NOTHING_TO_INLINE") @file:Suppress("NOTHING_TO_INLINE")
package net.mamoe.mirai.console.plugins package net.mamoe.mirai.console.plugin
import kotlinx.atomicfu.locks.withLock import kotlinx.atomicfu.locks.withLock
import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.MiraiConsole

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.plugins package net.mamoe.mirai.console.plugin
import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.MiraiConsole
import java.io.File import java.io.File

View File

@ -7,15 +7,14 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.plugins.builtin package net.mamoe.mirai.console.plugin.builtin
import kotlinx.coroutines.* import kotlinx.coroutines.*
import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.MiraiConsole
import net.mamoe.mirai.console.plugins.AbstractFilePluginLoader import net.mamoe.mirai.console.plugin.AbstractFilePluginLoader
import net.mamoe.mirai.console.plugins.PluginLoadException import net.mamoe.mirai.console.plugin.PluginLoadException
import net.mamoe.mirai.console.plugins.PluginsLoader import net.mamoe.mirai.console.plugin.PluginsLoader
import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.MiraiLogger
import net.mamoe.mirai.utils.error
import net.mamoe.yamlkt.Yaml import net.mamoe.yamlkt.Yaml
import java.io.File import java.io.File
import java.net.URL import java.net.URL

View File

@ -9,7 +9,7 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "EXPOSED_SUPER_CLASS") @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "EXPOSED_SUPER_CLASS")
package net.mamoe.mirai.console.plugins.builtin package net.mamoe.mirai.console.plugin.builtin
import kotlinx.atomicfu.locks.withLock import kotlinx.atomicfu.locks.withLock
import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineExceptionHandler
@ -17,8 +17,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.MiraiConsole
import net.mamoe.mirai.console.plugins.Plugin import net.mamoe.mirai.console.plugin.Plugin
import net.mamoe.mirai.console.plugins.PluginLoader import net.mamoe.mirai.console.plugin.PluginLoader
import net.mamoe.mirai.console.utils.JavaPluginScheduler import net.mamoe.mirai.console.utils.JavaPluginScheduler
import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.MiraiLogger
import java.util.concurrent.locks.ReentrantLock import java.util.concurrent.locks.ReentrantLock

View File

@ -7,15 +7,15 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.plugins.builtin package net.mamoe.mirai.console.plugin.builtin
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient import kotlinx.serialization.Transient
import net.mamoe.mirai.console.plugins.FilePluginDescription import net.mamoe.mirai.console.plugin.FilePluginDescription
import net.mamoe.mirai.console.plugins.PluginDependency import net.mamoe.mirai.console.plugin.PluginDependency
import net.mamoe.mirai.console.plugins.PluginDescription import net.mamoe.mirai.console.plugin.PluginDescription
import net.mamoe.mirai.console.plugins.PluginKind import net.mamoe.mirai.console.plugin.PluginKind
import java.io.File import java.io.File
@Serializable @Serializable

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.plugins package net.mamoe.mirai.console.plugin
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer

View File

@ -24,7 +24,7 @@ import kotlin.reflect.full.findAnnotation
internal abstract class SettingImpl { internal abstract class SettingImpl {
@JvmField @JvmField
internal var valueList: MutableList<Pair<Value<*>, KProperty<*>>> = mutableListOf() internal var valueList: MutableList<Pair<Value<*>, Setting.PropertyInfo>> = mutableListOf()
@JvmField @JvmField
internal var built: Boolean = false internal var built: Boolean = false
@ -53,9 +53,7 @@ internal abstract class SettingImpl {
} }
} }
internal fun onElementChanged(value: Value<*>) { protected abstract fun onElementChanged(value: Value<*>)
println("my value changed!")
}
companion object { companion object {
@JvmStatic @JvmStatic
@ -78,8 +76,9 @@ internal class SettingUpdaterSerializer(
override val descriptor: SerialDescriptor by lazy { override val descriptor: SerialDescriptor by lazy {
@OptIn(MiraiExperimentalAPI::class) @OptIn(MiraiExperimentalAPI::class)
SerialDescriptor(instance.serialName) { SerialDescriptor(instance.serialName) {
for ((value, property) in instance.valueList) { for ((value, prop) in instance.valueList) {
element(property.serialNameOrPropertyName, value.serializer.descriptor, annotations, true) val (serialName, annotations) = prop
element(serialName, value.serializer.descriptor, annotations, true)
} }
} }
} }

View File

@ -10,10 +10,7 @@
package net.mamoe.mirai.console.utils package net.mamoe.mirai.console.utils
import net.mamoe.mirai.Bot import net.mamoe.mirai.Bot
import net.mamoe.mirai.console.MiraiConsole
import net.mamoe.mirai.console.plugins.*
import net.mamoe.mirai.contact.User import net.mamoe.mirai.contact.User
import java.io.File
/** /**

View File

@ -11,7 +11,7 @@ package net.mamoe.mirai.console.utils
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.future.future import kotlinx.coroutines.future.future
import net.mamoe.mirai.console.plugins.builtin.JavaPlugin import net.mamoe.mirai.console.plugin.builtin.JavaPlugin
import java.util.concurrent.Callable import java.util.concurrent.Callable
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
import java.util.concurrent.Future import java.util.concurrent.Future

View File

@ -12,7 +12,7 @@
package net.mamoe.mirai.console.command package net.mamoe.mirai.console.command
import net.mamoe.mirai.Bot import net.mamoe.mirai.Bot
import net.mamoe.mirai.console.plugins.builtin.KotlinPlugin import net.mamoe.mirai.console.plugin.builtin.KotlinPlugin
import net.mamoe.mirai.message.data.* import net.mamoe.mirai.message.data.*
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals