📜  如何制作参数 minecraft java 代码示例

📅  最后修改于: 2022-03-11 14:52:20.843000             🧑  作者: Mango

代码示例1
if (alias.equalsIgnoreCase("hello") {
    if (args.length == 0) { //Sender only typed '/hello' and nothing else
        sender.sendMessage("You only typed hello!");
 
    } else { //Sender typed more then 1 argument, so args[0] can't be null.
        if (args[0].equalsIgnoreCase("sir") { //Sender typed '/hello sir'
            sender.sendMessage("You typed hello sir!");
        } else { //Sender had attest 1 argument, but didn't type sir as a second one!
        //args[0] also returns string, so lets send the message right back to them!
            sender.sendMessage("Your first argument was: " + args[0]);
 
    }
}