Displays descriptions for each setting when displaying the value

This commit is contained in:
2023-11-16 19:44:35 +01:00
parent ac6fc430ff
commit 4282cd8a2f
5 changed files with 141 additions and 56 deletions

View File

@ -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, '&')));