package net.knarcraft.blacksmith.formatting; import net.knarcraft.knarlib.formatting.FormatBuilder; import net.knarcraft.knarlib.formatting.TranslatableMessage; import org.jetbrains.annotations.NotNull; /** * An enum containing all translatable global messages * *
This does not include NPC messages as they are configurable per-npc, and can be translated by changing the * default message values in the main config file.
*/ public enum Translatable implements TranslatableMessage { /** * The message displayed when a configuration value has been successfully changed */ VALUE_CHANGED, /** * The message displayed when a configuration value for one material or enchantment has been successfully changed */ VALUE_FOR_ITEM_CHANGED, /** * The message displayed when showing the current value of a configuration option */ CURRENT_VALUE, /** * The message displayed when showing the default value of a configuration option */ DEFAULT_VALUE, /** * The message displayed when showing the current value of a configuration option for one material or enchantment */ CURRENT_VALUE_FOR_ITEM, /** * The translation of enchantment */ ITEM_TYPE_ENCHANTMENT, /** * The translation of material */ ITEM_TYPE_MATERIAL, /** * The message displayed when showing the "raw" value of messages */ RAW_VALUE, /** * The message displayed when trying to change a blacksmith value before selecting a blacksmith */ NO_NPC_SELECTED, /** * The message displayed if a string list is required, but something else is given */ INPUT_STRING_LIST_REQUIRED, /** * The message displayed if a value between 0 and 100 is required, but something else is given */ INPUT_PERCENTAGE_REQUIRED, /** * The message displayed if a string is required, but something else is given */ INPUT_STRING_REQUIRED, /** * The message displayed if a positive double is required, but something else is given */ INPUT_POSITIVE_DOUBLE_REQUIRED, /** * The message displayed if a positive integer is required, but something else is given */ INPUT_POSITIVE_INTEGER_REQUIRED, /** * The message displayed if a player is missing the required permission for an action */ PERMISSION_DENIED, /** * The message displayed if this plugin is successfully reloaded */ PLUGIN_RELOADED, /** * The message displayed if a filter is specified which isn't supported by the specified preset */ INVALID_FILTER_FOR_PRESET, /** * The message displayed if an invalid preset or an invalid filter is specified */ INVALID_PRESET_OR_FILTER, /** * The message displayed when showing which materials are included in a preset */ PRESET_MATERIALS, /** * The text to display when describing less than 10 seconds remaining */ INTERVAL_LESS_THAN_10_SECONDS, /** * The text to display when describing less than 30 seconds remaining */ INTERVAL_LESS_THAN_30_SECONDS, /** * The text to display when describing less than 1 minute remaining */ INTERVAL_LESS_THAN_1_MINUTE, /** * The text to display when describing less than 5 minutes remaining */ INTERVAL_LESS_THAN_5_MINUTES, /** * The text to display when describing more than 5 minutes remaining */ INTERVAL_MORE_THAN_5_MINUTES, /** * The marker used for displaying that a given setting has been overridden for the selected NPC */ SETTING_OVERRIDDEN_MARKER, /** * The format to use for formatting any message spoken by a blacksmith NPC */ NPC_TALK_FORMAT, /** * The text to display when explaining that a cost must be a positive double */ DOUBLE_COST_REQUIRED; /** * Gets the message to display when displaying the raw value of messages * * @param rawValueThe raw value to display
* @returnThe format builder to display
*/ @NotNull public static FormatBuilder getRawValueMessage(@NotNull String rawValue) { return new FormatBuilder(Translatable.RAW_VALUE).color().replace("{rawValue}", rawValue); } /** * Gets the message to display when a value has been changed * * @param settingThe setting whose value has been changed
* @param newValueThe new value of the setting
* @returnThe format builder to display to a user
*/ @NotNull public static FormatBuilder getValueChangedMessage(@NotNull String setting, @NotNull String newValue) { return new FormatBuilder(Translatable.VALUE_CHANGED).replace("{setting}", setting). replace("{newValue}", newValue); } /** * Gets the message to display when a value has been changed for an item * * @param settingThe setting whose value has been changed
* @param itemTypeThe type of item changed ("material" or "enchantment")
* @param itemThe item the setting was changed for (a material or an enchantment name)
* @param newValueThe new value of the setting
* @returnThe format builder to display to a user
*/ @NotNull public static FormatBuilder getItemValueChangedMessage(@NotNull String setting, @NotNull ItemType itemType, @NotNull String item, @NotNull String newValue) { return new FormatBuilder(Translatable.VALUE_FOR_ITEM_CHANGED).replace("{setting}", setting). replace("{itemType}", itemType.getItemTypeName()).replace("{item}", item). replace("{newValue}", newValue); } /** * Gets the message to display when displaying a setting's default value * * @param settingThe setting whose value is shown
* @param defaultValueThe default value of the setting
* @returnThe format builder to display to a user
*/ @NotNull public static FormatBuilder getDefaultValueMessage(@NotNull String setting, @NotNull String defaultValue) { return new FormatBuilder(Translatable.DEFAULT_VALUE).replace("{setting}", setting). replace("{defaultValue}", defaultValue); } /** * Gets the message to display when displaying a setting's current value * * @param settingThe setting whose value is shown
* @param currentValueThe current value of the setting
* @returnThe format builder to display to a user
*/ @NotNull public static FormatBuilder getCurrentValueMessage(@NotNull String setting, @NotNull String currentValue) { return new FormatBuilder(Translatable.CURRENT_VALUE).replace("{setting}", setting). replace("{currentValue}", currentValue); } /** * Gets the message to display when displaying a setting's current value for an item * * @param settingThe setting whose value is shown
* @param itemTypeThe type of item shown ("material" or "enchantment")
* @param itemThe item the setting is shown for (a material or an enchantment name)
* @param currentValueThe current value of the setting
* @returnThe format builder to display to a user
*/ @NotNull public static FormatBuilder getItemCurrentValueMessage(@NotNull String setting, @NotNull ItemType itemType, @NotNull String item, @NotNull String currentValue) { return new FormatBuilder(Translatable.CURRENT_VALUE_FOR_ITEM).replace("{setting}", setting). replace("{itemType}", itemType.getItemTypeName()).replace("{item}", item). replace("{currentValue}", currentValue); } @Override @NotNull public TranslatableMessage[] getAllMessages() { return Translatable.values(); } }