JSimpleCommand
abstract class JSimpleCommand @JvmOverloads constructor(owner: CommandOwner, primaryName: String, secondaryNames: String, basePermission: Permission) : SimpleCommand
Content copied to clipboard
Java 实现:
public final class MySimpleCommand extends JSimpleCommand {
public static final MySimpleCommand INSTANCE = new MySimpleCommand();
private MySimpleCommand() {
super(MyPlugin.INSTANCE, "tell")
// 可选设置如下属性
setDescription("这是一个测试指令")
setUsage("/tell <target> <message>") // 如不设置则自动根据带有 @Handler 的方法生成
setPermission(CommandPermission.Operator.INSTANCE)
setPrefixOptional(true)
}
@Handler
public void onCommand(CommandSender sender, User target, String message) {
target.sendMessage(message)
}
}
Content copied to clipboard
See also
Constructors
JSimpleCommand
Link copied to clipboard
fun JSimpleCommand(owner: CommandOwner, primaryName: String, vararg secondaryNames: String, basePermission: Permission = owner.parentPermission)
Content copied to clipboard
Properties
context
Link copied to clipboard
指令参数环境. 默认为 CommandArgumentContext.Builtins+
overrideContext
description
Link copied to clipboard
描述, 用于显示在 BuiltInCommands.HelpCommand
overloads
Link copied to clipboard
owner
Link copied to clipboard
permission
Link copied to clipboard
prefixOptional
Link copied to clipboard
为 true
时表示 指令前缀 可选.
primaryName
Link copied to clipboard
secondaryNames
Link copied to clipboard