Wiki 9Minecraft Wiki 9Minecraft
Cnusername Plugin Wiki › Guides › How to Customize Allowed Characters Using pattern.txt

How to Customize Allowed Characters Using pattern.txt

Out of the box, CnUsername Plugin checks incoming player names against a default regular expression that allows standard letters, digits, and underscores alongside a shorter name form permitting Chinese characters. When your community wants to allow additional symbols, restrict certain formats, or tailor name length rules inside the 16-character cap, you can edit the rule directly in pattern.txt.

Editing Your Custom Name Rule

1. Let the server generate the CnUsername folder at least once, then stop your server before making changes.

2. Open pattern.txt inside the CnUsername folder with a UTF-8 capable text editor so Chinese characters or other non-standard symbols save without corruption.

3. Replace or adjust the regular expression in pattern.txt to match the exact character set and name shape your server allows.

4. Save pattern.txt and restart the server, because CnUsername reads pattern.txt on startup and changes do not take effect until a full restart completes.

Testing Rules and Avoiding Common Mistakes

After restarting, connect with both a standard alphanumeric account and a player name using Chinese or special characters while watching the server console to confirm each name passes validation. Remember two hard boundaries when writing custom rules: packet decoder limits always cap usernames at 16 characters, and on Paper or its forks perform-validate-username must still be set to false or valid custom names will be blocked before your pattern.txt rule ever runs. Keep a backup of your working pattern.txt before editing.

Join 9Minecraft News & Guides