Skip to content
Jack edited this page Jun 16, 2026 · 3 revisions

Locale System

GriefPrevention3D supports localized messages via YAML locale files. The plugin loads messages based on the GriefPrevention.Locale config setting.

Quick Start

  1. Set your locale in config.yml:

    GriefPrevention:
      Locale: es
  2. Copy the desired locale file from Lang/ 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
    
  3. Restart the server or run /greload.

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 to BUNDLED_LOCALE_FILES in DataStore.java
  3. Add locale entries to startups.txt (e.g., fr1[..., fr2[..., fr3[...)
  4. 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.

Clone this wiki locally