Update CommandAction.java

This commit is contained in:
lilingfengdev 2024-01-30 15:39:23 +08:00 committed by GitHub
parent 1fcf826fb3
commit dab31dba51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -36,7 +36,7 @@ public class CommandAction extends NPCShopAction {
@Override
public String describe() {
String description = commands.size() + " command";
String description = commands.size() + " 命令";
for (int i = 0; i < commands.size(); i++) {
description += "\n" + commands.get(i);
if (i == 3) {
@ -82,7 +82,7 @@ public class CommandAction extends NPCShopAction {
});
}
@Menu(title = "Command editor", dimensions = { 4, 9 })
@Menu(title = "命令编辑器", dimensions = { 4, 9 })
public static class CommandActionEditor extends InventoryMenuPage {
private CommandAction base;
private Consumer<NPCShopAction> callback;
@ -101,8 +101,8 @@ public class CommandAction extends NPCShopAction {
int idx = i;
ctx.getSlot(i).clear();
if (i < base.commands.size()) {
ctx.getSlot(i).setItemStack(new ItemStack(Material.FEATHER), "<f>Set command",
"Right click to remove\nCurrently: " + base.commands.get(i));
ctx.getSlot(i).setItemStack(new ItemStack(Material.FEATHER), "<f>设置命令",
"右键删除\n当前: " + base.commands.get(i));
}
ctx.getSlot(i).setClickHandler(event -> {
if (event.isRightClick()) {
@ -130,14 +130,14 @@ public class CommandAction extends NPCShopAction {
});
}
ctx.getSlot(3 * 9 + 3).setItemStack(new ItemStack(Util.getFallbackMaterial("COMMAND_BLOCK", "COMMAND")),
"Run commands as server", base.server ? ChatColor.GREEN + "On" : ChatColor.RED + "OFF");
"以服务器身份运行指令", base.server ? ChatColor.GREEN + "" : ChatColor.RED + "");
ctx.getSlot(3 * 9 + 3).addClickHandler(InputMenus.toggler(res -> base.server = res, base.server));
ctx.getSlot(3 * 9 + 4).setItemStack(
new ItemStack(Util.getFallbackMaterial("COMPARATOR", "REDSTONE_COMPARATOR")), "Run commands as op",
base.op ? ChatColor.GREEN + "On" : ChatColor.RED + "OFF");
new ItemStack(Util.getFallbackMaterial("COMPARATOR", "REDSTONE_COMPARATOR")), "以OP 身份运行指令",
base.op ? ChatColor.GREEN + "" : ChatColor.RED + "");
ctx.getSlot(3 * 9 + 4).addClickHandler(InputMenus.clickToggle(res -> {
base.op = res;
return res ? ChatColor.GREEN + "On" : ChatColor.RED + "Off";
return res ? ChatColor.GREEN + "" : ChatColor.RED + "";
}, base.server));
}
@ -168,4 +168,4 @@ public class CommandAction extends NPCShopAction {
return action instanceof CommandAction;
}
}
}
}