Conversation
3 tasks
Adds multi-language support using a server-wide default locale with optional per-player override (similar to LuckPerms/EssentialsX). - Introduce MessageRegistry with immutable Snapshot for thread-safe atomic swaps during hot-reloads - Refactor Message class to use deferred resolution, applying token replacements at resolve time with locale-aware lookups - Add locale cascading fallback (e.g. zh_tw -> zh -> default) - Migrate messages from single messages.yml to messages/ directory with per-locale files (messages_en.yml, etc.), retaining messages.yml as a backward-compatible overlay - Add locale config (locale.default, locale.perPlayer) to config.yml - Persist player locale in bm_players table (VARCHAR(16)) via V2 database migration, gated by perPlayerLocale config - Add locale-aware kick(Message) and broadcast(Message, String) APIs to CommonPlayer and CommonServer - Migrate all kick() and broadcast() call sites (17 kick, 26 broadcast) to the new Message-based overloads - Implement platform-specific getLocale() across Bukkit, Bungee, Velocity, Sponge (API7+API8), and Fabric (with pre-1.21 fallback) - Add locale-aware DateUtils overloads for localised time formatting - Log loaded locales and missing key diagnostics on startup - Add comprehensive tests: MessageRegistry, Message deferred resolution, locale normalisation, player storage locale persistence, DB migration - Add E2E locale smoke test with German locale fixture - Update E2E sync-configs.sh to distribute messages/ directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds multi-language support to BanManager using a hybrid localisation model — a server-wide default locale with optional per-player overrides (similar to LuckPerms & EssentialsX).
Core changes
Snapshotfor thread-safe atomic swaps during hot-reloads. Supports cascading locale fallback (e.g.zh_tw→zh→ default)resolve(locale)/resolveFor(player)messages.ymltomessages/directory with per-locale files (messages_en.yml, etc.). Legacymessages.ymlretained as a backward-compatible overlaylocale.defaultandlocale.perPlayersettings inconfig.ymllocalecolumn (VARCHAR(16)) inbm_playerstable via V2 database migration, gated bylocale.perPlayerconfigkick(Message)onCommonPlayerandbroadcast(Message, String)onCommonServerfor per-player locale resolutionkick()and 26broadcast()call sites migrated to the newMessage-based overloadsTesting
MessageRegistryTest,MessageDeferredTest,LocaleNormalisationTest,PlayerStorageTest(locale persistence),MigrationIntegrationTest(V2 schema)KickCommandTest,KickAllCommandTest,LoglessKickAllCommandTest,NoteListenerTest,MessagesConfigTest,ConfigReloadTest,CommonJoinListenerTestlocale-smoke.test.tswith German locale fixture, reload resilience checkTest plan
masterbmreloadpreserves messages and picks up new locale files