public class Roll extends JSimpleCommand {
public static final Roll INSTANCE = new Roll();
private Roll() {
super(Plugin.INSTANCE, "roll");
setDescription("roll点数");
}
int number = 0;
Random r = new Random();
@Handler
public void handle(MemberCommandSenderOnMessage sender,int range,String string){
if(range>0&&range<=32768) {
number = r.nextInt(range+1);
sender.sendMessage(string + "是 " + number + "/" + range);
}else{
sender.sendMessage("点数超出范围!请输入1-32768之间的整数");
}
}
}
代码如上,但实际使用时不管是参数不足还是输入/help查询指令,都会显示:
a276cf9b-52d0-46a2-826c-b8c9d53caa45-image.png
或者
3845dba3-1e0f-42e0-8fd9-f10911e6fa29-image.png
比较想知道如何才能让它正确显示参数名?