From 4282cd8a2f43853b542ea9cd2bdda98bfe34082d Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 16 Nov 2023 19:44:35 +0100 Subject: [PATCH] Displays descriptions for each setting when displaying the value --- .../blacksmith/command/EditCommand.java | 13 ++- .../knarcraft/blacksmith/config/Setting.java | 7 ++ .../config/blacksmith/BlacksmithSetting.java | 95 +++++++++++++------ .../config/scrapper/ScrapperSetting.java | 68 +++++++++---- .../blacksmith/util/ConfigCommandHelper.java | 14 ++- 5 files changed, 141 insertions(+), 56 deletions(-) diff --git a/src/main/java/net/knarcraft/blacksmith/command/EditCommand.java b/src/main/java/net/knarcraft/blacksmith/command/EditCommand.java index d02c00e..777075f 100644 --- a/src/main/java/net/knarcraft/blacksmith/command/EditCommand.java +++ b/src/main/java/net/knarcraft/blacksmith/command/EditCommand.java @@ -10,6 +10,7 @@ import net.knarcraft.blacksmith.formatting.BlacksmithTranslatableMessage; import net.knarcraft.blacksmith.trait.CustomTrait; import net.knarcraft.blacksmith.util.InputParsingHelper; import net.knarcraft.blacksmith.util.TypeValidationHelper; +import net.knarcraft.knarlib.formatting.StringFormatter; import net.md_5.bungee.api.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -31,7 +32,7 @@ import static net.knarcraft.blacksmith.formatting.BlacksmithTranslatableMessage. */ public abstract class EditCommand, L extends Setting> implements CommandExecutor { - protected Class traitClass; + protected final Class traitClass; public EditCommand(Class traitClass) { this.traitClass = traitClass; @@ -150,16 +151,22 @@ public abstract class EditCommand, L extends Setting> i "been initialized! Please inform the developer!"); return; } + + StringFormatter formatter = BlacksmithPlugin.getStringFormatter(); + + // Display the description for how this setting is used + formatter.displaySuccessMessage(sender, setting.getDescription()); + String rawValue = String.valueOf(settings.getRawValue(setting)); if (InputParsingHelper.isEmpty(rawValue)) { //Display the default value, if no custom value has been specified rawValue = String.valueOf(globalSettings.getRawValue(setting)); - BlacksmithPlugin.getStringFormatter().displaySuccessMessage(sender, + formatter.displayNeutralMessage(sender, getCurrentValueMessage(setting.getCommandName(), rawValue)); } else { //Add a marker if the value has been customized String marker = BlacksmithPlugin.translate(BlacksmithTranslatableMessage.SETTING_OVERRIDDEN_MARKER); - BlacksmithPlugin.getStringFormatter().displaySuccessMessage(sender, + formatter.displayNeutralMessage(sender, getCurrentValueMessage(setting.getCommandName(), rawValue) + marker); } if (setting.isMessage()) { diff --git a/src/main/java/net/knarcraft/blacksmith/config/Setting.java b/src/main/java/net/knarcraft/blacksmith/config/Setting.java index 1a01033..4c52e3b 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/Setting.java +++ b/src/main/java/net/knarcraft/blacksmith/config/Setting.java @@ -42,6 +42,13 @@ public interface Setting { */ @NotNull SettingValueType getValueType(); + /** + * Gets the description explaining the usage of this setting + * + * @return

This setting's description

+ */ + @NotNull String getDescription(); + /** * Gets whether this setting can be set per-NPC, or if it's set globally * diff --git a/src/main/java/net/knarcraft/blacksmith/config/blacksmith/BlacksmithSetting.java b/src/main/java/net/knarcraft/blacksmith/config/blacksmith/BlacksmithSetting.java index e10a89a..feca9cd 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/blacksmith/BlacksmithSetting.java +++ b/src/main/java/net/knarcraft/blacksmith/config/blacksmith/BlacksmithSetting.java @@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** - * An enum representing all of Blacksmith's settings + * An enum representing all blacksmith-related settings */ public enum BlacksmithSetting implements Setting { @@ -15,55 +15,66 @@ public enum BlacksmithSetting implements Setting { * *

If set to false, the item will be directly put in the player's inventory instead

*/ - DROP_ITEM("dropItem", SettingValueType.BOOLEAN, true, "dropItem", true, false), + DROP_ITEM("dropItem", SettingValueType.BOOLEAN, true, "dropItem", "Whether the " + + "item will drop a reforged item on the ground, instead of putting it into the user's inventory", + true, false), /** * The setting for the chance of a reforging to fail */ FAIL_CHANCE("failReforgeChance", SettingValueType.PERCENTAGE, 10, "failReforgeChance", + "The chance to fail reforging an item, which only repairs the item a tiny bit or not at all (0-100)", true, false), /** * The setting for whether failing a reforging should downgrade/remove enchantments as well */ FAIL_REMOVE_ENCHANTMENTS("failReforgeRemovesEnchantments", SettingValueType.BOOLEAN, false, - "failReforgeRemovesEnchantments", true, false), + "failReforgeRemovesEnchantments", "Whether failed reforging should remove or " + + "downgrade the item's enchantments", true, false), /** * The setting for the chance of an additional enchantment being added */ EXTRA_ENCHANTMENT_CHANCE("extraEnchantmentChance", SettingValueType.PERCENTAGE, 5, - "extraEnchantmentChance", true, false), + "extraEnchantmentChance", "The chance that an enchantment will be added to the " + + "reforged item (0-100)", true, false), /** * The setting for the maximum amount of enchantments that can be added to an item */ MAX_ENCHANTMENTS("maxEnchantments", SettingValueType.POSITIVE_INTEGER, 3, - "maxEnchantments", true, false), + "maxEnchantments", "The maximum number of enchantments the blacksmith will try to" + + " add", true, false), /** * The maximum amount of seconds a player may need to wait for the reforging to finish */ MAX_REFORGE_DELAY("delaysInSeconds.maximum", SettingValueType.POSITIVE_INTEGER, 30, - "maxReforgeDelay", true, false), + "maxReforgeDelay", "The maximum time for a reforging to finish", + true, false), /** * The minimum amount of seconds a player may need to wait for the reforging to finish */ MIN_REFORGE_DELAY("delaysInSeconds.minimum", SettingValueType.POSITIVE_INTEGER, 5, - "minReforgeDelay", true, false), + "minReforgeDelay", "The minimum time for a reforging to finish", + true, false), /** * The setting for number of seconds a player has to wait between each usage of the blacksmith */ REFORGE_COOL_DOWN("delaysInSeconds.reforgeCoolDown", SettingValueType.POSITIVE_INTEGER, 60, - "reforgeCoolDown", true, false), + "reforgeCoolDown", "The cool-down period between each reforge", + true, false), /** * The setting for which items the blacksmith is able to reforge */ REFORGE_ABLE_ITEMS("reforgeAbleItems", SettingValueType.REFORGE_ABLE_ITEMS, "", - "reforgeAbleItems", true, false), + "reforgeAbleItems", "The items a blacksmith is able to reforge. Setting this only " + + "allows NPCs to repair the listed items. This should be set for each individual NPC, and should not be set" + + " here, unless you want to restrict NPCs which have not been set up yet.", true, false), /** * The setting for the title used to display which kind of blacksmith the NPC is @@ -72,19 +83,22 @@ public enum BlacksmithSetting implements Setting { * describe the blacksmith's specialization, and thus the range of reforge-able items, is expected.

*/ BLACKSMITH_TITLE("blacksmithTitle", SettingValueType.STRING, "blacksmith", - "blacksmithTitle", true, false), + "blacksmithTitle", "The title describing the blacksmith's usage/speciality", + true, false), /** * The setting for the enchantments a blacksmith cannot apply to items */ ENCHANTMENT_BLOCKLIST("enchantmentBlocklist", SettingValueType.STRING_LIST, new String[]{"binding_curse", - "mending", "vanishing_curse"}, "enchantmentBlocklist", true, false), + "mending", "vanishing_curse"}, "enchantmentBlocklist", "The enchantments a " + + "blacksmith is denied from applying to an item. Disable anything you find too op or annoying.", + true, false), /** * Whether to allow this blacksmith to repair anvils */ REPAIR_ANVILS("reforgeAnvils", SettingValueType.BOOLEAN, false, "reforgeAnvils", - true, false), + "Whether the blacksmith will reforge anvils as a special case", true, false), /*----------- | Messages | @@ -95,74 +109,81 @@ public enum BlacksmithSetting implements Setting { */ BUSY_WITH_PLAYER_MESSAGE("messages.busyPlayerMessage", SettingValueType.STRING, "&cI'm busy at the moment. Come back later!", "busyPlayerMessage", - true, true), + "The message to display when another player is using the blacksmith", true, true), /** * The message displayed when the blacksmith is already reforging something for the player */ BUSY_WITH_REFORGE_MESSAGE("messages.busyReforgeMessage", SettingValueType.STRING, "&cI'm working on it. Be patient! I'll finish {time}!", "busyReforgeMessage", - true, true), + "The message to display when the blacksmith is working on the reforging", true, true), /** * The message displayed if the player has to wait for the cool-down to expire */ COOL_DOWN_UNEXPIRED_MESSAGE("messages.coolDownUnexpiredMessage", SettingValueType.STRING, "&cYou've already had your chance! Give me a break! I'll be ready {time}!", - "coolDownUnexpiredMessage", true, true), + "coolDownUnexpiredMessage", "The message to display when the blacksmith is still on" + + " a cool-down from the previous re-forging", true, true), /** * The message displayed when displaying the cost of reforging the held item to the player */ COST_MESSAGE("messages.costMessage", SettingValueType.STRING, "&eIt will cost &a{cost}&e to reforge that &a{item}&e! Click again to reforge!", - "costMessage", true, true), + "costMessage", "The message to display when informing a player about the reforging" + + " cost", true, true), /** * The message displayed if the blacksmith fails reforging an item */ FAIL_MESSAGE("messages.failReforgeMessage", SettingValueType.STRING, "&cWhoops! Didn't mean to do that! Maybe next time?", "failReforgeMessage", - true, true), + "The message to display when the blacksmith fails to reforge an item", true, true), /** * The message displayed if a player is unable to pay the blacksmith */ INSUFFICIENT_FUNDS_MESSAGE("messages.insufficientFundsMessage", SettingValueType.STRING, "&cYou don't have enough money to reforge that item!", "insufficientFundsMessage", - true, true), + "The message to display when a player cannot pay for the reforging", true, true), /** * The message displayed if the blacksmith encounters an item they cannot reforge */ INVALID_ITEM_MESSAGE("messages.invalidItemMessage", SettingValueType.STRING, "&cI'm sorry, but I'm a/an {title}, I don't know how to reforge that!", - "invalidItemMessage", true, true), + "invalidItemMessage", "The message to display when holding an item the blacksmith " + + "is unable to reforge", true, true), /** * The message displayed if a player presents a different item after seeing the price to reforge an item */ ITEM_UNEXPECTEDLY_CHANGED_MESSAGE("messages.itemChangedMessage", SettingValueType.STRING, "&cThat's not the item you wanted to reforge before!", "itemChangedMessage", + "The message to display when presenting a different item than the one just evaluated", true, true), /** * The message displayed when the blacksmith starts reforging an item */ START_REFORGE_MESSAGE("messages.startReforgeMessage", SettingValueType.STRING, - "&eOk, let's see what I can do...", "startReforgeMessage", true, true), + "&eOk, let's see what I can do...", "startReforgeMessage", "The message to " + + "display once the blacksmith starts re-forging", true, true), /** * The message displayed when the blacksmith successfully finishes reforging an item */ SUCCESS_MESSAGE("messages.successMessage", SettingValueType.STRING, - "There you go! All better!", "successMessage", true, true), + "There you go! All better!", "successMessage", "The message to display once " + + "the reforging has successfully finished", true, true), /** * The message displayed when trying to reforge an item with full durability */ NOT_DAMAGED_MESSAGE("messages.notDamagedMessage", SettingValueType.STRING, - "&cThat item is not in need of repair", "notDamagedMessage", true, true), + "&cThat item is not in need of repair", "notDamagedMessage", "The message to " + + "display if a player is trying to reforge an item with full durability", true, true), /*------------------ | Global settings | @@ -174,7 +195,7 @@ public enum BlacksmithSetting implements Setting { *

This allows specifying a price for each item, by setting basePrice.item_name.

*/ BASE_PRICE("basePrice.default", SettingValueType.POSITIVE_DOUBLE, 10.0, "basePrice", - false, false), + "The minimum price of each cost", false, false), /** * The base price for each durability point @@ -184,7 +205,8 @@ public enum BlacksmithSetting implements Setting { * durability point value for each item, by setting pricePerDurabilityPoint.item_name

*/ PRICE_PER_DURABILITY_POINT("pricePerDurabilityPoint.default", SettingValueType.POSITIVE_DOUBLE, - 0.005, "pricePerDurabilityPoint", false, false), + 0.005, "pricePerDurabilityPoint", "The additional cost for each durability " + + "point missing (natural cost) or present (not natural cost)", false, false), /** * The price increase for each level of each present enchantment @@ -192,37 +214,44 @@ public enum BlacksmithSetting implements Setting { *

This can be specified for each possible enchantment by setting enchantment-cost.enchantment_name

*/ ENCHANTMENT_COST("enchantmentCost.default", SettingValueType.POSITIVE_DOUBLE, 5.0, - "enchantmentCost", false, false), + "enchantmentCost", "The additional cost for each enchantment level present on an item", + false, false), /** * Whether the cost should increase for damage taken, as opposed to increase for durability present */ NATURAL_COST("useNaturalCost", SettingValueType.BOOLEAN, true, "useNaturalCost", - false, false), + "Natural cost makes re-forging more expensive the more damaged the item is. Disabling this will " + + "enable the legacy blacksmith behavior instead", false, false), /** * Whether to show exact time when displaying the wait time for a reforging or the cool-down */ SHOW_EXACT_TIME("showExactTime", SettingValueType.BOOLEAN, false, "showExactTime", + "Exact time displays the exact number of seconds and minutes remaining as part of the reforging" + + " cool-down and reforging delay messages, instead of just vaguely hinting at the remaining time.", false, false), /** * The cost for repairing a chipped anvil */ ANVIL_CHIPPED_COST("chippedAnvilReforgingCost", SettingValueType.POSITIVE_DOUBLE, 10.0, - "chippedAnvilReforgingCost", false, false), + "chippedAnvilReforgingCost", "The cost of fully repairing a chipped anvil", + false, false), /** * The cost for repairing a damaged anvil */ ANVIL_DAMAGED_COST("damagedAnvilReforgingCost", SettingValueType.POSITIVE_DOUBLE, 20.0, - "damagedAnvilReforgingCost", false, false); + "damagedAnvilReforgingCost", "The cost of fully repairing a damaged anvil", + false, false); private final String path; private final String childPath; private final Object value; private final String commandName; private final SettingValueType valueType; + private final String description; private final boolean isPerNPC; private final boolean isMessage; @@ -233,10 +262,12 @@ public enum BlacksmithSetting implements Setting { * @param valueType

The type of value used by this setting

* @param value

The default value of this setting

* @param commandName

The name of the command used to change this setting

+ * @param description

The description describing this setting

* @param isPerNPC

Whether this setting is per-NPC or global

* @param isMessage

Whether this option is for an NPC message

*/ - BlacksmithSetting(String path, SettingValueType valueType, Object value, String commandName, boolean isPerNPC, + BlacksmithSetting(@NotNull String path, @NotNull SettingValueType valueType, @NotNull Object value, + @NotNull String commandName, @NotNull String description, boolean isPerNPC, boolean isMessage) { if (isPerNPC) { this.path = "blacksmith.defaults." + path; @@ -247,6 +278,7 @@ public enum BlacksmithSetting implements Setting { this.valueType = valueType; this.childPath = path; this.commandName = commandName; + this.description = description; this.isPerNPC = isPerNPC; this.isMessage = isMessage; } @@ -276,6 +308,11 @@ public enum BlacksmithSetting implements Setting { return this.valueType; } + @Override + public @NotNull String getDescription() { + return this.description; + } + @Override public boolean isPerNPC() { return this.isPerNPC; diff --git a/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java b/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java index 1fabc6c..e6cf069 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java +++ b/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java @@ -5,6 +5,9 @@ import net.knarcraft.blacksmith.config.SettingValueType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * An enum representing all scrapper-related settings + */ public enum ScrapperSetting implements Setting { /** @@ -12,38 +15,45 @@ public enum ScrapperSetting implements Setting { * *

If set to false, the item will be directly put in the player's inventory instead

*/ - DROP_ITEM("dropItem", SettingValueType.BOOLEAN, true, "dropItem", - true, false), + DROP_ITEM("dropItem", SettingValueType.BOOLEAN, true, "dropItem", "Whether the " + + "item will drop materials resulting from scrapping on the ground, instead of putting them into the user's" + + " inventory", true, false), /** * The chance of a scrapper returning no salvage, regardless of item condition */ FAIL_SALVAGE_CHANCE("failSalvageChance", SettingValueType.POSITIVE_DOUBLE, 0, - "failSalvageChance", true, false), + "failSalvageChance", "The chance to fail a salvage, thus destroying the item (0-100)", + true, false), /** * The setting for which items a scrapper is able to salvage */ SALVAGE_ABLE_ITEMS("salvageAbleItems", SettingValueType.REFORGE_ABLE_ITEMS, "", - "salvageAbleItems", true, false), + "salvageAbleItems", "The items a blacksmith is able to salvage. Setting this only " + + "allows NPCs to repair the listed items. This should be set for each individual NPC, and should not be " + + "set here, unless you want to restrict NPCs which have not been set up yet", true, false), /** * The maximum amount of seconds a player may need to wait for the reforging to finish */ MAX_SALVAGE_DELAY("delaysInSeconds.maximum", SettingValueType.POSITIVE_INTEGER, 30, - "maxReforgeDelay", true, false), + "maxReforgeDelay", "The maximum time for a salvaging to finish", + true, false), /** * The minimum amount of seconds a player may need to wait for the reforging to finish */ MIN_SALVAGE_DELAY("delaysInSeconds.minimum", SettingValueType.POSITIVE_INTEGER, 5, - "minReforgeDelay", true, false), + "minReforgeDelay", "The minimum time for a salvaging to finish", + true, false), /** * The setting for number of seconds a player has to wait between each usage of the blacksmith */ - SALVAGE_COOL_DOWN("delaysInSeconds.reforgeCoolDown", SettingValueType.POSITIVE_INTEGER, 60, - "reforgeCoolDown", true, false), + SALVAGE_COOL_DOWN("delaysInSeconds.salvageCoolDown", SettingValueType.POSITIVE_INTEGER, 60, + "salvageCoolDown", "The cool-down period between each salvage", + true, false), /*----------- | Messages | @@ -54,13 +64,14 @@ public enum ScrapperSetting implements Setting { */ BUSY_WITH_PLAYER_MESSAGE("messages.busyPlayerMessage", SettingValueType.STRING, "&cI'm busy at the moment. Come back later!", "busyPlayerMessage", - true, true), + "The message to display when another player is using the scrapper", true, true), /** * The message displayed when the scrapper is busy salvaging the player's item */ BUSY_WITH_SALVAGE_MESSAGE("messages.busySalvageMessage", SettingValueType.STRING, "&cI'm working on it. Be patient! I'll finish {time}!", "busySalvageMessage", + "The message to display when the blacksmith is working on the salvaging", true, true), /** @@ -68,39 +79,45 @@ public enum ScrapperSetting implements Setting { */ COOL_DOWN_UNEXPIRED_MESSAGE("messages.coolDownUnexpiredMessage", SettingValueType.STRING, "&cYou've already had your chance! Give me a break! I'll be ready {time}!", - "coolDownUnexpiredMessage", true, true), + "coolDownUnexpiredMessage", "The message to display when the blacksmith is still " + + "on a cool-down from the previous re-forging", true, true), /** * The message displayed if presented with an item that cannot be salvaged by the NPC */ CANNOT_SALVAGE_MESSAGE("messages.cannotSalvageMessage", SettingValueType.STRING, - "&cI'm unable to salvage that item", "cannotSalvageMessage", true, true), + "&cI'm unable to salvage that item", "cannotSalvageMessage", "The message to " + + "display if the player tries to salvage an item the blacksmith cannot salvage", true, true), /** * The message displayed if salvaging an item would return in no items */ TOO_DAMAGED_FOR_SALVAGE_MESSAGE("messages.tooDamagedForSalvageMessage", SettingValueType.STRING, "&cThat item is too damaged to be salvaged into anything useful", - "tooDamagedForSalvageMessage", true, true), + "tooDamagedForSalvageMessage", "The message to display if reforging the player's " + + "item would result in no salvage", true, true), /** * The message displayed if a salvage is successful */ SUCCESS_SALVAGE_MESSAGE("messages.successSalvagedMessage", SettingValueType.STRING, "&cThere you go!", - "successSalvagedMessage", true, true), + "successSalvagedMessage", "The message to display when an item is successfully " + + "salvaged", true, true), /** * The message displayed if a player presents a different item after seeing the price to reforge an item */ ITEM_UNEXPECTEDLY_CHANGED_MESSAGE("messages.itemChangedMessage", SettingValueType.STRING, "&cThat's not the item you wanted to reforge before!", "itemChangedMessage", + "The message to display when presenting a different item than the one just evaluated", true, true), /** * The message displayed when the scrapper starts salvaging an item */ START_SALVAGE_MESSAGE("messages.startSalvageMessage", SettingValueType.STRING, - "&eOk, let's see what I can do...", "startSalvageMessage", true, true), + "&eOk, let's see what I can do...", "startSalvageMessage", "The message to " + + "display once the blacksmith starts re-forging", true, true), /*------------------ | Global settings | @@ -109,14 +126,17 @@ public enum ScrapperSetting implements Setting { /** * Whether to display exact time in minutes and seconds when displaying a remaining cool-down */ - SHOW_EXACT_TIME("scrapper.global.showExactTime", SettingValueType.BOOLEAN, "false", - "showExactTime", false, false), + SHOW_EXACT_TIME("showExactTime", SettingValueType.BOOLEAN, "false", + "showExactTime", "Exact time displays the exact number of seconds and minutes " + + "remaining as part of the scrapping cool-down and scrapping delay messages, instead of just vaguely " + + "hinting at the remaining time.", false, false), /** * Whether to give experience back when salvaging an enchanted item */ - GIVE_EXPERIENCE("scrapper.global.giveExperience", SettingValueType.BOOLEAN, "true", - "giveExperience", false, false), + GIVE_EXPERIENCE("giveExperience", SettingValueType.BOOLEAN, "true", "giveExperience", + "Whether enchanted salvaged items should return some amount of exp upon salvage", + false, false), ; private final String path; @@ -124,6 +144,7 @@ public enum ScrapperSetting implements Setting { private final Object value; private final String commandName; private final SettingValueType valueType; + private final String description; private final boolean isPerNPC; private final boolean isMessage; @@ -134,11 +155,12 @@ public enum ScrapperSetting implements Setting { * @param valueType

The type of value used by this setting

* @param value

The default value of this setting

* @param commandName

The name of the command used to change this setting

+ * @param description

The description describing this setting

* @param isPerNPC

Whether this setting is per-NPC or global

* @param isMessage

Whether this option is for an NPC message

*/ - ScrapperSetting(String path, SettingValueType valueType, Object value, String commandName, boolean isPerNPC, - boolean isMessage) { + ScrapperSetting(String path, SettingValueType valueType, Object value, String commandName, + @NotNull String description, boolean isPerNPC, boolean isMessage) { if (isPerNPC) { this.path = "scrapper.defaults." + path; } else { @@ -148,6 +170,7 @@ public enum ScrapperSetting implements Setting { this.valueType = valueType; this.childPath = path; this.commandName = commandName; + this.description = description; this.isPerNPC = isPerNPC; this.isMessage = isMessage; } @@ -177,6 +200,11 @@ public enum ScrapperSetting implements Setting { return this.valueType; } + @Override + public @NotNull String getDescription() { + return this.description; + } + @Override public boolean isPerNPC() { return this.isPerNPC; diff --git a/src/main/java/net/knarcraft/blacksmith/util/ConfigCommandHelper.java b/src/main/java/net/knarcraft/blacksmith/util/ConfigCommandHelper.java index aaddfda..3b8e6b2 100644 --- a/src/main/java/net/knarcraft/blacksmith/util/ConfigCommandHelper.java +++ b/src/main/java/net/knarcraft/blacksmith/util/ConfigCommandHelper.java @@ -5,6 +5,7 @@ import net.knarcraft.blacksmith.config.Setting; import net.knarcraft.blacksmith.config.SettingValueType; import net.knarcraft.blacksmith.config.Settings; import net.knarcraft.blacksmith.formatting.BlacksmithTranslatableMessage; +import net.knarcraft.knarlib.formatting.StringFormatter; import net.md_5.bungee.api.ChatColor; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; @@ -67,11 +68,16 @@ public final class ConfigCommandHelper { printRawValue = true; } - //Display the current value of the setting - BlacksmithPlugin.getStringFormatter().displaySuccessMessage(sender, - BlacksmithTranslatableMessage.getCurrentValueMessage(correctCommandName, settingValue)); + StringFormatter formatter = BlacksmithPlugin.getStringFormatter(); - //Print the value with any colors displayed as &a-f0-9 + // Display the description of the setting + formatter.displaySuccessMessage(sender, setting.getDescription()); + + // Display the current value of the setting + formatter.displayNeutralMessage(sender, BlacksmithTranslatableMessage.getCurrentValueMessage( + correctCommandName, settingValue)); + + // Print the value with any colors displayed as &a-f0-9 if (printRawValue) { sender.sendMessage(BlacksmithTranslatableMessage.getRawValueMessage( settingValue.replace(ChatColor.COLOR_CHAR, '&')));