diff --git a/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithStringFormatter.java b/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithStringFormatter.java index dfd0d14..fb85ea2 100644 --- a/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithStringFormatter.java +++ b/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithStringFormatter.java @@ -1,9 +1,9 @@ package net.knarcraft.blacksmith.formatting; import net.citizensnpcs.api.npc.NPC; +import net.knarcraft.blacksmith.BlacksmithPlugin; import net.knarcraft.knarlib.property.ColorConversion; import net.knarcraft.knarlib.util.ColorHelper; -import net.md_5.bungee.api.ChatColor; import org.bukkit.entity.Player; /** @@ -23,8 +23,10 @@ public final class BlacksmithStringFormatter { * @param message
The message to send
*/ public static void sendNPCMessage(NPC npc, Player player, String message) { - player.sendMessage(ChatColor.GREEN + "[" + npc.getName() + "] -> You:" + ChatColor.RESET + " " + - ColorHelper.translateColorCodes(message, ColorConversion.NORMAL)); + player.sendMessage(BlacksmithPlugin.getStringFormatter().replacePlaceholders( + BlacksmithTranslatableMessage.NPC_TALK_FORMAT, + new String[]{"{npc}", "{message}"}, + new String[]{npc.getName(), ColorHelper.translateColorCodes(message, ColorConversion.RGB)})); } } diff --git a/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithTranslatableMessage.java b/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithTranslatableMessage.java index 87b7ae6..20c6711 100644 --- a/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithTranslatableMessage.java +++ b/src/main/java/net/knarcraft/blacksmith/formatting/BlacksmithTranslatableMessage.java @@ -130,7 +130,12 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage { /** * The marker used for displaying that a given setting has been overridden for the selected NPC */ - SETTING_OVERRIDDEN_MARKER; + SETTING_OVERRIDDEN_MARKER, + + /** + * The format to use for formatting any message spoken by a blacksmith NPC + */ + NPC_TALK_FORMAT; /** * Gets the message to display when displaying the raw value of messages diff --git a/src/main/resources/strings.yml b/src/main/resources/strings.yml index 31436c3..22bc6fc 100644 --- a/src/main/resources/strings.yml +++ b/src/main/resources/strings.yml @@ -18,6 +18,7 @@ en: INVALID_PRESET_OR_FILTER: "You specified an invalid preset or an invalid filter" PRESET_MATERIALS: "Materials in preset: {materials}" DURATION_FORMAT: "in {time} {unit}" + NPC_TALK_FORMAT: "&a[{npc}] -> You:&r {message}" UNIT_NOW: "imminently" UNIT_SECOND: "second" UNIT_SECONDS: "seconds"