Update docs about example for commands for Java

This commit is contained in:
Him188 2021-05-03 17:06:50 +08:00
parent 3321cdeac3
commit 03df2d8bb7
4 changed files with 16 additions and 9 deletions

View File

@ -18,6 +18,7 @@
package net.mamoe.mirai.console.command package net.mamoe.mirai.console.command
import net.mamoe.mirai.console.command.descriptor.* import net.mamoe.mirai.console.command.descriptor.*
import net.mamoe.mirai.console.command.java.JCompositeCommand
import net.mamoe.mirai.console.compiler.common.ResolveContext import net.mamoe.mirai.console.compiler.common.ResolveContext
import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.COMMAND_NAME import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.COMMAND_NAME
import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.RESTRICTED_CONSOLE_COMMAND_OWNER import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.RESTRICTED_CONSOLE_COMMAND_OWNER
@ -31,7 +32,9 @@ import kotlin.annotation.AnnotationTarget.FUNCTION
/** /**
* 复合指令. 指令注册时候会通过反射构造指令解析器. * 复合指令. 指令注册时候会通过反射构造指令解析器.
* *
* 示例: * Java 示例查看 [JCompositeCommand].
*
* Kotlin 示例:
* ``` * ```
* @OptIn(ConsoleExperimentalAPI::class) * @OptIn(ConsoleExperimentalAPI::class)
* object MyCompositeCommand : CompositeCommand( * object MyCompositeCommand : CompositeCommand(

View File

@ -76,7 +76,7 @@ public abstract class RawCommand(
* *
* @param args 指令参数. * @param args 指令参数.
* *
* @see CommandManager.execute 查看更多信息 * @see CommandManager.executeCommand 查看更多信息
*/ */
public abstract suspend fun CommandSender.onCommand(args: MessageChain) public abstract suspend fun CommandSender.onCommand(args: MessageChain)
} }

View File

@ -33,10 +33,12 @@ import kotlin.annotation.AnnotationTarget.VALUE_PARAMETER
/** /**
* 简单的, 支持参数自动解析的指令. * 简单的, 支持参数自动解析的指令.
* *
* 要查看指令解析流程, 参考 [CommandManager.executeCommand] * 要查看指令解析流程, 参考 [CommandManager.executeCommand].
* 要查看参数解析方式, 参考 [CommandValueArgumentParser] * 要查看参数解析方式, 参考 [CommandValueArgumentParser].
* *
* Kotlin 实现: * Java 示例查看 [JSimpleCommand].
*
* Kotlin 示例:
* ``` * ```
* object MySimpleCommand : SimpleCommand( * object MySimpleCommand : SimpleCommand(
* MyPlugin, "tell", * MyPlugin, "tell",

View File

@ -1,10 +1,10 @@
/* /*
* Copyright 2019-2020 Mamoe Technologies and contributors. * Copyright 2019-2021 Mamoe Technologies and contributors.
* *
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link. * 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 * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.console.command.java package net.mamoe.mirai.console.command.java
@ -68,6 +68,8 @@ import net.mamoe.mirai.console.permission.Permission
* } * }
* ``` * ```
* *
* Kotlin 示例查看 [CompositeCommand]
*
* @see buildCommandArgumentContext * @see buildCommandArgumentContext
*/ */
public abstract class JCompositeCommand public abstract class JCompositeCommand