Changes things for the non-static Translator

This commit is contained in:
2022-11-07 15:20:30 +01:00
parent 7875e9a705
commit a501a3cbb4
10 changed files with 70 additions and 37 deletions

View File

@ -1,8 +1,8 @@
package net.knarcraft.blacksmith.formatting;
import net.knarcraft.blacksmith.BlacksmithPlugin;
import net.knarcraft.knarlib.formatting.StringFormatter;
import net.knarcraft.knarlib.formatting.TranslatableMessage;
import net.knarcraft.knarlib.formatting.Translator;
/**
* An enum containing all translatable global messages
@ -144,8 +144,8 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
* @return <p>The message to display</p>
*/
public static String getRawValueMessage(String rawValue) {
return StringFormatter.replacePlaceholder(Translator.getTranslatedMessage(BlacksmithTranslatableMessage.RAW_VALUE),
"{rawValue}", rawValue);
return StringFormatter.replacePlaceholder(BlacksmithPlugin.getTranslator().getTranslatedMessage(
BlacksmithTranslatableMessage.RAW_VALUE), "{rawValue}", rawValue);
}
/**
@ -156,8 +156,9 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
* @return <p>The string to display to a user</p>
*/
public static String getValueChangedMessage(String setting, String newValue) {
return StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(BlacksmithTranslatableMessage.VALUE_CHANGED),
new String[]{"{setting}", "{newValue}"}, new String[]{setting, newValue});
return StringFormatter.replacePlaceholders(BlacksmithPlugin.getTranslator().getTranslatedMessage(
BlacksmithTranslatableMessage.VALUE_CHANGED), new String[]{"{setting}", "{newValue}"},
new String[]{setting, newValue});
}
/**
@ -170,7 +171,8 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
* @return <p>The string to display to a user</p>
*/
public static String getItemValueChangedMessage(String setting, ItemType itemType, String item, String newValue) {
return StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(BlacksmithTranslatableMessage.VALUE_FOR_ITEM_CHANGED),
return StringFormatter.replacePlaceholders(BlacksmithPlugin.getTranslator().getTranslatedMessage(
BlacksmithTranslatableMessage.VALUE_FOR_ITEM_CHANGED),
new String[]{"{setting}", "{itemType}", "{item}", "{newValue}"},
new String[]{setting, itemType.getItemTypeName(), item, newValue});
}
@ -183,8 +185,9 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
* @return <p>The string to display to a user</p>
*/
public static String getCurrentValueMessage(String setting, String currentValue) {
return StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(BlacksmithTranslatableMessage.CURRENT_VALUE),
new String[]{"{setting}", "{currentValue}"}, new String[]{setting, currentValue});
return StringFormatter.replacePlaceholders(BlacksmithPlugin.getTranslator().getTranslatedMessage(
BlacksmithTranslatableMessage.CURRENT_VALUE), new String[]{"{setting}", "{currentValue}"},
new String[]{setting, currentValue});
}
/**
@ -197,7 +200,8 @@ public enum BlacksmithTranslatableMessage implements TranslatableMessage {
* @return <p>The string to display to a user</p>
*/
public static String getItemCurrentValueMessage(String setting, ItemType itemType, String item, String currentValue) {
return StringFormatter.replacePlaceholders(Translator.getTranslatedMessage(BlacksmithTranslatableMessage.CURRENT_VALUE_FOR_ITEM),
return StringFormatter.replacePlaceholders(BlacksmithPlugin.getTranslator().getTranslatedMessage(
BlacksmithTranslatableMessage.CURRENT_VALUE_FOR_ITEM),
new String[]{"{setting}", "{itemType}", "{item}", "{currentValue}"},
new String[]{setting, itemType.getItemTypeName(), item, currentValue});
}