Java SDK — Moderation

The local TextFilter gives an instant offline verdict from the embedded hashed wordlist; censor() is the authoritative server check and also returns the masked display text. A missed local flag still fails server-side.

Moderation

Moderation.censor
public static CensorResponse censor(
    Client client,
    String text
) throws IOException

Calls POST /api/censor.php — the authoritative server check (max 1000 characters). Returns clean flag, the masked display-safe filtered text, and retryAfter on a 429 reply.

TextFilter — local checks
TextFilter.isClean(text)
TextFilter.filter(text)
TextFilter.isNameAllowed(name)
TextFilter.filterName(name, "Player")

Instant offline screening using the embedded salted-hash data — no request needed. The server stays authoritative: a missed local flag still fails server-side.

Local filter, server verdict

Censor is the authoritative moderation call: it returns the server-side profanity verdict — and the masked text — for names, lobby titles and chat-class strings. The matcher normalizes case, compatibility forms, confusable characters, digit lookalikes and repeated runs, so obfuscated spellings still match before the verdict comes back.

The server already screens automatically at registration, rename and room creation — censor exists for surfaces the server never sees, like free-form chat or pre-submit feedback. SDKs also ship a local TextFilter built from the same wordlist for instant offline checks; a miss locally still fails server-side, so never treat a local pass as final.

  • Apply the check to every user-visible string — player names, room titles, chat — not just account names.
  • The verdict returns masked display text as well as the decision, for surfaces that filter rather than reject.
  • Name and room rules are separate from profanity — both apply server-side at the same endpoints.
  • Calls return CompletableFuture — compose with thenApply/thenAccept, or join() on a worker thread when blocking is acceptable; never join on a UI or render thread.