Adding a server code of conduct (Minecraft: Java Edition)

If you run a public server, it is recommended to add a code of conduct. A code of conduct allows you to inform your players about the rules of your server before they start playing. It can be enabled in Minecraft: Java Edition 1.21.9+ and be made available in multiple languages.

java

Minecraft allows setting a code of conduct for your server that will be shown to players when they first join your server. Only if a player acknowledges your code of conduct will they be allowed to play.

Code of conduct dialog in Minecraft showing example text

Writing a good code of conduct

While you can generally write your code of conduct however you like and however fits your server, you can use the following tips to make it as effective as possible:

  • Keep it clear and simple
    Use straightforward language. Players of all ages should understand the rules without confusion.
  • Be specific, but not overly strict
    Define what not to do (e.g. griefing, hacking), but don’t try to list every possible offense. Leave room for staff judgment.
  • Match the rules to your server type
    PvP servers need different rules than Creative or Roleplay ones. Tailor your rules to the gameplay and community style.
  • Set the tone you want
    The way you write your rules sets the mood. Friendly, fair, and respectful wording encourages the same behavior.
  • Explain why rules exist
    Briefly stating the reason behind a rule (e.g. "No griefing - we want a safe space to build") makes players more likely to respect it.
  • Be transparent about enforcement
    Let players know what happens if rules are broken (e.g. warnings, temp bans). Consistency builds trust.
  • Keep it short and organized
    Too many rules can overwhelm players. Stick to the essentials and use headers, bullets, or numbers for easy reading.

Adding your code of conduct to your server

Create the code of conduct folder

Your server will look for code of conduct files in a folder called codeofconduct inside your main server folder. To create it, open the Files page, click the New Folder button, enter codeofconduct as the folder name, and confirm.

Click the "New Folder" button and enter "codeofconduct" as the folder name

Add code of conduct files

All code of conduct files are text files inside the codeofconduct folder. They should be named in the format <language_code>.txt, where <language_code> is the code for the language the text is written in. 

When a player joins, Minecraft will first look for a code of conduct written in the language currently used by the player. If that language is not available, English (en_us) is used. If no English text is available, the first available text in any language is used.

The selection of languages you translate your code of conduct to is up to you, but there needs to be at least one language available, and there should be an English version as a fallback.

You can create a file by clicking the New File button and entering a name, and click it to edit it and add your text.

Click "New File" and enter "<language_code>.txt" (e.g. "en_us.txt") as the file name

After creating the file, click it to open it in the file editor and add your code of conduct text.

Click the file to edit it, and enter your code of conduct text

Enable the code of conduct

After adding your code of conduct, you need to enable it in your server.properties file.

"Code of conduct" server option enabled

Restart your server

After starting/restarting your server, players will be shown your code of conduct upon connecting to your server.