Makes edit commands display the default value if no value is provided
This commit is contained in:
@@ -30,6 +30,11 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -186,6 +191,20 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
|
||||
return stringReplacer.replace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message to display when displaying a setting's default value
|
||||
*
|
||||
* @param setting <p>The setting whose value is shown</p>
|
||||
* @param defaultValue <p>The default value of the setting</p>
|
||||
* @return <p>The string to display to a user</p>
|
||||
*/
|
||||
@NotNull
|
||||
public static String getDefaultValueMessage(@NotNull String setting, @NotNull String defaultValue) {
|
||||
return BlacksmithPlugin.getStringFormatter().replacePlaceholders(BlacksmithTranslatableMessage.DEFAULT_VALUE,
|
||||
List.of("{setting}", "{defaultValue}"),
|
||||
List.of(setting, defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message to display when displaying a setting's current value
|
||||
*
|
||||
|
Reference in New Issue
Block a user