Add Java bridge for implementing ConsoleInput

This commit is contained in:
Him188 2020-09-13 00:26:50 +08:00
parent 7d9d181002
commit aa3c8baccb

View File

@ -118,6 +118,9 @@ public interface MiraiConsoleImplementation : CoroutineScope {
withContext(Dispatchers.IO) { sendMessageJ(message) }
}
/**
* [ConsoleCommandSender]
*/
public val consoleCommandSender: ConsoleCommandSenderImpl
public val dataStorageForJvmPluginLoader: PluginDataStorage
@ -127,9 +130,27 @@ public interface MiraiConsoleImplementation : CoroutineScope {
/**
* @see ConsoleInput 的实现
* @see JConsoleInput
*/
public val consoleInput: ConsoleInput
/**
* Java 用户实现 [ConsoleInput]
*/
@Suppress("INAPPLICABLE_JVM_NAME")
@ConsoleFrontEndImplementation
public interface JConsoleInput : ConsoleInput {
/**
* @see ConsoleInput.requestInput
*/
@JvmName("requestInput")
public fun requestInputJ(hint: String): String
override suspend fun requestInput(hint: String): String {
return withContext(Dispatchers.IO) { requestInputJ(hint) }
}
}
/**
* 创建一个 [LoginSolver]
*