Fixed console purges with a radius purging all worlds (#1026)

/co purge rejects a numeric radius, but the check only saw the radius
when the sender had a location. From the console, /co purge t:30d r:50
parsed no radius and no world, so it ran as a server-wide purge. The
radius is now also parsed against a placeholder location, so it is
rejected for every sender. r:#world is unaffected.


Claude-Session: https://claude.ai/code/session_01PdEuKbjcVoVinVQJq4te1f

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
tonyjamesstarkandClaude authored and GitHub committed 2026-10-02 13:58:53 -06:00
1 parent 4e70d63978
commit 29d22d5a58
1 file changed
+2 -1
@@ -192,7 +192,8 @@ public class PurgeCommand extends Consumer {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return;
}
if (argRadius != null) {
// Without a location (console), a numeric radius parses to null and the purge would run server-wide
if (argRadius != null || CommandParser.parseRadius(args, player, new Location(null, 0, 0, 0)) != null) {
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.INVALID_WORLD)).build());
return;
}