Menu

Locale

Jack Korte

Locale System

GriefPrevention3D supports localized messages via YAML locale files. The plugin loads messages based on the GriefPrevention.Locale config setting, and can also send messages in a player's own language with per-player locale support.

Quick Start

Server Language

To change the server's default language, set the locale code in config.yml:

GriefPrevention:
  Locale: es

Then either:

  • Copy the desired locale file from the Lang/ folder to the data folder root:
    GriefPreventionData/ Lang/ messages_en.yml <- bundled reference copies (refreshed on restart) messages_es.yml messages_pt_BR.yml messages_es.yml <- your active locale file (copied here by you) config.yml

  • Or just set Locale: in config.yml and delete or move any old messages_*.yml files — the plugin will extract the matching locale file automatically on the next restart or /greload.

Restart the server or run /greload.

Per-Player Language (Automatic)

Players with a Spanish or Portuguese Minecraft client locale will receive messages in their language automatically — no configuration needed. This is enabled by default with:

GriefPrevention:
  PerPlayerLocale: true

See Per-Player Locale for details.

File Locations

Path Purpose
GriefPreventionData/messages_{locale}.yml Active locale files read by the plugin
GriefPreventionData/Lang/ Reference copies extracted from JAR on every restart
GriefPreventionData/messages.yml Legacy file (backward compatibility)

Loading Priority

  1. messages_{locale}.yml — matches your config_locale setting (e.g., messages_es.yml for Locale: es)
  2. messages.yml — legacy fallback for servers migrated from older versions
  3. Auto-detect — if neither exists, scans for any messages_*.yml and auto-switches
  4. Extract from JAR — if nothing found, extracts the matching locale from the JAR

Auto-Detection

If your config says Locale: en but only messages_es.yml exists in the data folder, the plugin auto-switches to Spanish and logs:

Locale 'en' didn't match provided messages_es.yml. Auto-switched to 'es'

The in-memory locale is updated so the startup header and all messages use the detected language.

Key Merging

On every startup, the plugin compares your deployed locale file against the bundled JAR version. Any missing keys are automatically added and saved to your file. This means:

  • New messages added in plugin updates appear automatically after restart
  • You don't need to manually edit your locale file when upgrading
  • Your customizations are preserved (existing keys are never overwritten)

Supported Locales

Locale Language
en English
es Spanish
pt_BR Brazilian Portuguese

Adding a New Locale

  1. Create messages_{locale}.yml in the JAR's resource path (under src/main/resources/)
  2. Add the locale code to SUPPORTED_LOCALE_CODES in MessageLocalization.java
  3. Add the filename to BUNDLED_LOCALE_FILES in MessageLocalization.java
  4. Add locale entries to startups.txt (e.g., fr1[..., fr2[..., fr3[...)
  5. The plugin will extract it to Lang/ on next restart

Editing Messages

Each message is stored under a Messages. key matching the enum name in Messages.java:

Messages:
  ClaimCreated: "Claims created successfully."
  NoPermission: "You don't have permission to do that."

You can customize any message by editing the corresponding key in your locale file. The plugin uses $ or & as color code prefixes, and supports &#RRGGBB hex colors.

Startup Header

The startup header respects your locale setting. If you have locale entries in startups.txt matching your config (e.g., es1[..., es2[..., es3[...), the plugin displays a localized header on startup.

For locales with a region suffix (e.g., pt_BR), the header falls back to the base language (e.g., pt) if no exact match is found.


Related

Wiki: Key Features
Wiki: _Sidebar

Auth0 Logo