Block the /execute ... run datapack command

The /datapack list command is useless, and the other 2 subcommands (/datapack enable and /datapack disable) can be used to cause huge lag on the server.
This commit is contained in:
GEOEGII555 2024-08-10 16:04:00 +04:00 committed by GitHub
parent 2e79421d49
commit 7f81231c5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,7 @@ public final class ServerCommand implements Listener {
private static final Pattern SELECTOR_PATTERN = Pattern.compile("(?>\\s)*@[aepsr](?>\\s)*");
private static final Logger LOGGER = JavaPlugin.getPlugin(Main.class).getLogger();
private static final String[] COMMANDS = { "execute", "clone", "fill", "forceload", "kick",
private static final String[] COMMANDS = { "execute", "clone", "datapack", "fill", "forceload", "kick",
"locate", "locatebiome", "me", "msg", "reload", "save-all", "say", "spreadplayers",
"stop", "summon", "teammsg", "teleport", "tell", "tellraw", "tm", "tp", "w", "place",
"fillbiome", "ride" , "tick", "jfr"};
@ -173,6 +173,9 @@ public final class ServerCommand implements Listener {
return "cancel";
}
}
case "/minecraft:datapack", "/datapack" -> {
return "cancel";
}
case "/scissors:scissors", "/scissors" -> {
if (arr.length >= 2
&& "reload".equalsIgnoreCase(arr[1])) {