SimpleCommand
abstract class SimpleCommand( owner: CommandOwner, primaryName: String, secondaryNames: String, description: String = "no description available", parentPermission: Permission = owner.parentPermission, overrideContext: CommandArgumentContext = EmptyCommandArgumentContext) : AbstractCommand, Command, CommandArgumentContextAware
Content copied to clipboard
简单的, 支持参数自动解析的指令.
要查看指令解析流程, 参考 CommandManager.executeCommand. 要查看参数解析方式, 参考 CommandValueArgumentParser.
Java 示例查看 JSimpleCommand.
Kotlin 示例:
object MySimpleCommand : SimpleCommand(
MyPlugin, "tell",
description = "Message somebody"
) {
@Handler
suspend fun CommandSender.onCommand(target: User, message: String) {
target.sendMessage(message)
}
}
Content copied to clipboard
其中 CommandSender
也可以替换为 CommandContext
,可通过 CommandContext.originalMessage 获得触发指令的原消息链。
See also
Constructors
Link copied to clipboard
fun SimpleCommand( owner: CommandOwner, primaryName: String, vararg secondaryNames: String, description: String = "no description available", parentPermission: Permission = owner.parentPermission, overrideContext: CommandArgumentContext = EmptyCommandArgumentContext)
Content copied to clipboard
Properties
Link copied to clipboard
指令参数环境. 默认为 CommandArgumentContext.Builtins+
overrideContext
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard