Files
hamster-script/src/main/resources/code/example.js
2024-03-19 15:24:22 +08:00

16 lines
397 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function sayHi(user, params) {
var message = "";
if (params.length == 0) {
user.sendMessage("§aHi!");
return;
}
for (i in params) {
message = message + " " + params[i];
}
user.sendMessage("§eHi:" + message);
}
// 执行命令的对象会作为 sender玩家或控制台 变量传入
// 命令后的参数会作为 args数组 变量传入
sayHi(sender, args);