Checked arguments inside purge include and exclude lists

An include or exclude list that ended with a comma took the next token
as a list value whatever it was. The radius, world and action parsers
still read that token, so /co purge t:30d e:zombie, a:foo skipped the
kill-only action check and ran without an action restriction, and any
unknown key after a trailing comma skipped the unsupported argument
check. A list now continues only with plain or minecraft: namespaced
values; any other key ends the list and is checked as an argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LFQuzYmYun57wJi2a5mqkM
This commit is contained in:
Claude committed 2026-10-05 18:20:00 +00:00
1 parent ef2e11de32
commit 39deec370d
1 file changed
+8 -1
@@ -162,13 +162,15 @@ public class PurgeCommand extends Consumer {
continue;
}
if (listContinuation) {
if (listContinuation && isListValue(argument)) {
listContinuation = argument.endsWith(",");
if (hasListValue(argument)) {
emptyList = null;
}
continue;
}
// The radius, world and action parsers read a key such as r: or a: even inside a list
listContinuation = false;
if (argument.startsWith("a:") || argument.startsWith("action:")) {
// Only kills can be purged by action; any other value must not fall through to an unrestricted purge.
@@ -199,6 +201,11 @@ public class PurgeCommand extends Consumer {
return values.replace(",", "").length() > 0;
}
private static boolean isListValue(String argument) {
int separator = argument.indexOf(':');
return separator < 0 || argument.substring(0, separator).equals("minecraft");
}
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
Location location = CommandParser.parseLocation(player, args);