Description
Anti Spam is a behavior-pack addon that monitors player chat and automatically detects:
• Rapid messaging (too many messages in a short time)
• Repeated identical messages
• Repeated characters (e.g. aaaaaaa, !!!!!!!)
• Blocked words (NG words)
When a violation is detected, the addon can mute or kick the player. Mute status and NG-word warning counts are saved to the world, so they persist across reconnects and world reloads.
All admin commands require Operator permission level 2 (same as /op). Cheats do not need to be enabled.
───
Installation
1. Place the "Anti Spam" folder in your behavior packs directory:
.../development_behavior_packs/Anti Spam/
2. Open your world settings.
3. Go to Behavior Packs and activate "Anti Spam".
4. Re-enter the world (or restart it) so the scripts load.
Settings are stored inside the world using Dynamic Properties. They survive world saves and reloads.
───
Language Settings
The addon supports Japanese, English, and both (bilingual).
Commands:
/spam:language ja → Japanese only
/spam:language en → English only
/spam:language both → Both languages (default)
Default: both Messages appear like: English text | 日本語テキスト
───
What Gets Detected
1. Rapid messaging
If a player sends more messages than allowed within the configured time window, it counts as spam.
Default: More than 3 messages within 3 seconds triggers punishment.
2. Same message spam
If a player sends the same message repeatedly in a row, it counts as spam.
Default: 3 identical messages in a row triggers punishment.
3. Repeated characters
If a single character is repeated too many times in one message, it counts as spam.
Default: 8 or more consecutive identical characters (e.g. hellooooo, !!!!!!!!).
4. NG words (blocked words)
Messages containing blocked words are cancelled immediately.
Detection features:
• Case-insensitive matching (for English letters)
• Full-width / half-width normalization
• Katakana → Hiragana normalization (for Japanese)
Note: Matching is substring-based. A blocked word inside a longer word will also trigger a match.
───
Punishments
Spam punishment
Controlled by: /spam:punishment
Type "mute":
Player cannot chat for a set duration (default: 60 seconds)
Type "kick":
Player is kicked from the world
NG word punishment
Controlled by: /spam:ngpunishment (separate from spam punishment)
Type "kick":
After reaching the warning limit, the player is kicked (default)
Type "mute":
After reaching the warning limit, the player is muted
Type "warn_only":
Only warnings are shown; no kick or mute at the limit
NG word warning flow (default):
1st violation → warning (1/3)
2nd violation → warning (2/3)
3rd violation → kick (or mute, depending on settings)
Warning counts are saved per player and persist across reconnects.
───
Exemptions
The following players are not checked:
• Server Operators (OP) — exempt by default
• Players with the tag "spam_exempt" — exempt
To exempt a specific player without giving OP:
/tag <player>
add spam_exempt
To disable OP exemption:
/spam:config exempt_operators 0
To re-enable OP exemption:
/spam:config exempt_operators 1
───
Commands Reference
All commands start with /spam: and require Operator (level 2).
───
View settings
/spam:status
Shows all current settings: language, punishments, limits, exemptions, etc.
───
Language
/spam:language <ja|en|both>
Examples:
/spam:language ja
/spam:language en
/spam:language both
───
NG word management
/spam:ngword list /spam:ngword add <word>
/spam:ngword remove <word>
Examples:
/spam:ngword list
/spam:ngword add badword
/spam:ngword remove badword
Words are matched exactly as entered (but detection uses normalization at runtime).
───
Spam punishment
/spam:punishment mute <seconds>
/spam:punishment kick
Examples:
/spam:punishment mute 60
/spam:punishment mute 120
/spam:punishment kick
When using kick, the optional <seconds>
argument is not required. If you provide it, it still updates the stored mute duration for future mute use.
───
NG word punishment
/spam:ngpunishment <mute|kick|warn_only>
Examples:
/spam:ngpunishment kick
/spam:ngpunishment mute
/spam:ngpunishment warn_only
───
Fine-tune detection values
/spam:config <key>
<value>
Available keys:
time_window_sec
Time window for rapid-message detection (seconds)
Default: 3
max_messages
Max messages allowed within the time window
Default: 3
same_msg_limit
How many identical messages in a row trigger spam
Default: 3
max_ng_warnings
NG word warnings before final punishment
Default: 3
repeated_char_limit
Max consecutive identical characters allowed
Default: 8
exempt_operators
1 = OPs exempt, 0 = OPs are checked
Default: 1
Examples:
/spam:config time_window_sec 5
/spam:config max_messages 4
/spam:config same_msg_limit 3
/spam:config max_ng_warnings 5
/spam:config repeated_char_limit 6
/spam:config exempt_operators 1
Note: Values must be 0 or greater. For exempt_operators, only 0 or 1 is accepted.
───
Admin tools
Unmute a player:
/spam:unmute <playerName>
Reset NG warnings:
/spam:resetwarnings <playerName>
Reload configuration:
/spam:reload
View moderation logs:
/spam:logs
(Shows the 10 most recent events; up to 50 are stored in the world)
Logged events include:
• NG warnings
• NG kicks / mutes
• Spam mutes / kicks
• Manual unmutes
• Warning resets
───
Default Settings Summary
Language: both (English + Japanese) Spam punishment: mute NG word punishment: kick Mute duration: 60 seconds Time window: 3 seconds Max messages per window: 3 Same message limit: 3 in a row Repeated character limit: 8 characters Max NG warnings: 3 Operator exemption: Enabled Exempt tag: spam_exempt Max log entries stored: 50
───
Recommended Setup Examples
Casual survival server (lenient)
/spam:language both /spam:punishment mute 30 /spam:ngpunishment warn_only /spam:config time_window_sec 5 /spam:config max_messages 5 /spam:config repeated_char_limit 10
Public server (strict)
/spam:language en /spam:punishment mute 120 /spam:ngpunishment kick /spam:config time_window_sec 3 /spam:config max_messages 3 /spam:config max_ng_warnings 2 /spam:config repeated_char_limit 6
Japanese-only server
/spam:language ja /spam:ngword add バカ /spam:ngword add クズ /spam:ngpunishment mute /spam:punishment mute 90
───
Player Experience
When muted
Muted players cannot send chat. They see:
You are muted. Remaining: 45s
(or the Japanese / bilingual equivalent, depending on language setting)
Mute status persists if the player leaves and rejoins.
When an NG word is detected
The message is blocked. The player sees a warning:
[Warning] Inappropriate language detected. (1/3)
When spam is detected
The message is blocked. Depending on settings:
Mute example:
Muted for 60s due to spam (rapid messaging).
Kick:
A server-wide notice is shown, and the player is kicked.
───
Troubleshooting
Problem: Commands not found Solution: Ensure the behavior pack is active and re-enter the world
Problem: Commands say permission denied Solution: You need Operator level 2 (/op <yourName>
)
Problem: Settings seem unchanged Solution: Run /spam:reload, then /spam:status
Problem: OPs are being muted Solution: Run /spam:config exempt_operators 1
Problem: A player should be exempt Solution: Run /tag <player>
add spam_exempt
Problem: Mute persists after it should end Solution: Run /spam:unmute <playerName>
Problem: False NG word matches Solution: Remove or adjust words with /spam:ngword remove <word>
───
Technical Notes
• Chat only: Commands and signs are not monitored.
• Persistence: Config, player mutes/warnings, and logs are stored in world Dynamic Properties.
• Session data: Message timing data is kept in memory and resets when a player leaves (mute/warnings do not).
• Script API: Requires @minecraft/server (Beta APIs).
───
Quick Command Cheat Sheet
/spam:status /spam:language both /spam:ngword list /spam:ngword add <word>
/spam:ngword remove <word>
/spam:punishment mute 60 /spam:punishment kick /spam:ngpunishment kick /spam:config time_window_sec 3 /spam:config max_messages 3 /spam:unmute <player>
/spam:resetwarnings <player>
/spam:logs /spam:reload
───


