Skip to content

Make no-graves command messages configurable in grave.yml - #257

Open
v4r1n wants to merge 1 commit into
Legoman99573:forkfrom
v4r1n:fork
Open

Make no-graves command messages configurable in grave.yml#257
v4r1n wants to merge 1 commit into
Legoman99573:forkfrom
v4r1n:fork

Conversation

@v4r1n

@v4r1n v4r1n commented Jun 21, 2026

Copy link
Copy Markdown

Summary

This PR moves the hardcoded "no graves" command responses into the configurable message system under settings.default.default.message in grave.yml, so server owners can translate and restyle them like every other message the plugin sends.

Right now GravesCommand writes these strings inline with ChatColor, which bypasses message.prefix, ignores per-permission overrides, and leaves no way to localize them.

Motivation

Server owners already translate the message: section (for example empty: "You don't have any graves."). The command responses below stay hardcoded in English, so a translated server still shows English text in a different prefix style. This change makes them behave consistently with the rest of the message system.

Changes

New message keys (grave.ymlsettings.default.default.message)

no-graves: "You have no graves."
no-graves-other: "&c%name%&r has no graves."

%name% resolves to the target player's name via the existing EntityManager.sendMessage(String, Entity, String name, Location, List<String>) overload.

GravesCommand.java

Self — "You have no graves." (virtual + teleport paths):

plugin.getEntityManager().sendMessage("message.no-graves", player);

Other player — "<name> has no graves." (GUI + virtual + teleport paths):

plugin.getEntityManager().sendMessage("message.no-graves-other", player, args[1],
        player.getLocation(), plugin.getConfigManager().getPermissionList(player));

ConfigManager.java

Bump CURRENT_CONFIG_VERSION so ConfigUpdater merges the new keys into existing server configs on upgrade. ConfigUpdater preserves admin edits and only adds missing keys.

Behavior notes

  • Each message now uses the configured message.prefix instead of the inline ☠ » format, matching every other plugin message.
  • Setting a key to an empty string disables that message (the existing early-return convention in EntityManager.sendMessage).

Out of scope

This PR intentionally leaves the admin purge responses hardcoded — "No graves found for offline player ..." and "No graves found for UUID ...". Those commands respond to a CommandSender that can be the console, whereas EntityManager.sendMessage only delivers to a Player. Routing them through the message system would silently drop console output and break consistency with the surrounding admin feedback, so they deserve a separate change if desired.

Test plan

  • /graves teleport and /graves virtual with no graves → shows no-graves
  • /graves teleport <player> / /graves virtual <player> / GUI-other for a player with no graves → shows no-graves-other with correct name
  • Set no-graves to "" → no message sends
  • Upgrade from a prior config → new keys appear, existing custom messages remain untouched

Add two new configurable message keys under settings.default.default.message:
- no-graves: shown when a player has no graves (self context)
- no-graves-other: shown when a player has no graves (other player context, supports %name%)

Replace 7 hardcoded ChatColor.RED strings in GravesCommand with
EntityManager.sendMessage() calls so messages respect the configured
prefix, support localization, and can be silenced by setting the key to empty.

Bump CURRENT_CONFIG_VERSION 25 to 26 so ConfigUpdater merges the new
keys into existing server configs on next restart.

Admin purge responses (commandSender paths) remain hardcoded — they
target CommandSender (console-capable) where EntityManager.sendMessage
is Player-only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant