Makes the string replacer more useful for translatable messages
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good
This commit is contained in:
@@ -52,6 +52,43 @@ public final class StringReplacer {
|
||||
this.replacements.put(placeholder, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new string replacement
|
||||
*
|
||||
* @param stringFormatter <p>The string formatter to use for translation</p>
|
||||
* @param placeholder <p>The placeholder to replace</p>
|
||||
* @param value <p>The replacement value</p>
|
||||
*/
|
||||
public void add(@NotNull StringFormatter stringFormatter, @NotNull TranslatableMessage placeholder,
|
||||
@NotNull TranslatableMessage value) {
|
||||
this.replacements.put(stringFormatter.getUnFormattedMessage(placeholder),
|
||||
stringFormatter.getUnFormattedMessage(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new string replacement
|
||||
*
|
||||
* @param stringFormatter <p>The string formatter to use for translation</p>
|
||||
* @param placeholder <p>The placeholder to replace</p>
|
||||
* @param value <p>The replacement value</p>
|
||||
*/
|
||||
public void add(@NotNull StringFormatter stringFormatter, @NotNull String placeholder,
|
||||
@NotNull TranslatableMessage value) {
|
||||
this.replacements.put(placeholder, stringFormatter.getUnFormattedMessage(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new string replacement
|
||||
*
|
||||
* @param stringFormatter <p>The string formatter to use for translation</p>
|
||||
* @param placeholder <p>The placeholder to replace</p>
|
||||
* @param value <p>The replacement value</p>
|
||||
*/
|
||||
public void add(@NotNull StringFormatter stringFormatter, @NotNull TranslatableMessage placeholder,
|
||||
@NotNull String value) {
|
||||
this.replacements.put(stringFormatter.getUnFormattedMessage(placeholder), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a string replacement
|
||||
*
|
||||
|
Reference in New Issue
Block a user