Add DMCC command restriction in console command

This commit is contained in:
Xujiayao 2026-02-26 13:54:37 +08:00
parent a843cce0b3
commit 79a9aec67b
3 changed files with 12 additions and 0 deletions

View file

@ -137,6 +137,11 @@ public class ConsoleCommand implements Command {
commandLine = commandLine.substring(1);
}
if (commandLine.startsWith("dmcc")) {
sender.reply(I18nManager.getDmccTranslation("commands.console.dmcc_not_supported"));
return;
}
sender.reply(I18nManager.getDmccTranslation("commands.console.executing_local", commandLine));
EventManager.post(new CoreEvents.MinecraftCommandExecutionEvent(sender, commandLine));
@ -162,6 +167,11 @@ public class ConsoleCommand implements Command {
commandLine = commandLine.substring(1);
}
if (commandLine.startsWith("dmcc")) {
sender.reply(I18nManager.getDmccTranslation("commands.console.dmcc_not_supported"));
return;
}
List<String> targets = new ArrayList<>();
List<String> allConnected = NetworkManager.getConnectedClientNames();
String targetName;

View file

@ -29,6 +29,7 @@ commands:
invalid_target: "Invalid target DMCC Client: \"{}\". Available clients: {}"
all_online_clients: "all online DMCC clients"
no_online_clients: "No DMCC clients are online."
dmcc_not_supported: "Executing DMCC commands through \"console\" command is not supported. Please use \"execute\" command."
help:
description: "Show a list of available commands"
help: "Help"

View file

@ -29,6 +29,7 @@ commands:
invalid_target: "无效的目标 DMCC 客户端:\"{}\"。可用客户端:{}"
all_online_clients: "所有在线 DMCC 客户端"
no_online_clients: "没有在线的 DMCC 客户端。"
dmcc_not_supported: "通过 \"console\" 命令执行 DMCC 命令不受支持。请使用 \"execute\" 命令。"
help:
description: "显示可用命令列表"
help: "帮助"