Skip to content

Add wildcard and exclusion support to message filters - #954

Open
Ed6003 wants to merge 3 commits into
PlayPro:masterfrom
Ed6003:message-filter-wildcards
Open

Add wildcard and exclusion support to message filters#954
Ed6003 wants to merge 3 commits into
PlayPro:masterfrom
Ed6003:message-filter-wildcards

Conversation

@Ed6003

Copy link
Copy Markdown

Closes#159.

What

f:<filter> on a:chat/a:command/a:sign lookups only matched the start of a message. This adds:

  • * wildcards, so f:*ban* matches anywhere in a message (translated to SQL %)
  • a leading - to exclude, e.g. f:-/co, combinable with included filters (f:/ban,-/banlist)
  • the minimum filter length now ignores the - marker and * wildcards, so f:-ab and f:*a* are still rejected

Filters without a wildcard keep their exact existing SQL and query plan (still use the message prefix index added in __2_25_0). A wildcard filter that doesn't start with * still uses the anchored portion against the prefix index; a filter starting with * can't, since there's nothing to anchor on.

Verification

  • mvn -B verify passes.
  • This repo has no src/test tree, so as a substitute I ran the old and new query-builder logic side by side in a standalone harness across all four supported engines (SQLite, MySQL, DuckDB, ClickHouse): all existing (non-wildcard, non-excluded) filters produce byte-identical SQL and bindings to the current behavior, and placeholder/binding counts match for the new wildcard and exclusion forms.
  • Manually tested against a local Paper server.

Notes for review

  • f:<filter> itself is not new (added in 956828b) but was undocumented; I've added it to docs/commands.md in a separate commit.
  • Unanchored filters (f:*ban*) can't use the prefix index and will scan — inherent to mid-string matching, which is why I kept anchored filters on their existing plan rather than changing the query shape for everyone.
  • Split into 3 commits: the filter logic itself, the in-game help text, and the docs.

@Ed6003

Copy link
Copy Markdown
Author

Opted to use the filter: / f: flag. Inclusions and exclusions can be added comma separated.

By default lookup it looks for an exact starts with match. To match anywhere wildcards need to be used ie. string. Not sure if to make this the default behaviour. It is case insensitive by design but I also don't think there is a cheap way to make it case sensitive if required.

I've tested it on Vanilla 26.2 with Paper 26.2 build 112 and seems to work as expected for filtering text from chat, signs and commands.

@Ed6003
Ed6003 marked this pull request as ready for review August 13, 2026 08:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow filtering commands

1 participant

@Ed6003