Makes sure to color message text if a custom prefix is used
All checks were successful
EpicKnarvik97/KnarLib/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2023-07-09 18:03:22 +02:00
parent 3248704950
commit 5719a8ec4c

View File

@ -85,7 +85,7 @@ public final class StringFormatter {
* @param message <p>The translatable message to display</p>
*/
public void displayNeutralMessage(@NotNull CommandSender sender, @NotNull TranslatableMessage message) {
sender.sendMessage(getFormattedMessage(this.translator.getTranslatedMessage(message)));
displayNeutralMessage(sender, this.translator.getTranslatedMessage(message));
}
/**
@ -105,7 +105,7 @@ public final class StringFormatter {
* @param message <p>The translatable message to display</p>
*/
public void displaySuccessMessage(@NotNull CommandSender sender, @NotNull TranslatableMessage message) {
sender.sendMessage(successColor + getFormattedMessage(this.translator.getTranslatedMessage(message)));
displaySuccessMessage(sender, this.translator.getTranslatedMessage(message));
}
/**
@ -115,8 +115,12 @@ public final class StringFormatter {
* @param message <p>The raw message to display</p>
*/
public void displaySuccessMessage(@NotNull CommandSender sender, @NotNull String message) {
if (!this.namePrefix.equals("[") || !this.nameSuffix.equals("]")) {
sender.sendMessage(getFormattedMessage(successColor + message));
} else {
sender.sendMessage(successColor + getFormattedMessage(message));
}
}
/**
* Displays a message signifying an unsuccessful action
@ -125,7 +129,7 @@ public final class StringFormatter {
* @param message <p>The translatable message to display</p>
*/
public void displayErrorMessage(@NotNull CommandSender sender, @NotNull TranslatableMessage message) {
sender.sendMessage(errorColor + getFormattedMessage(this.translator.getTranslatedMessage(message)));
displayErrorMessage(sender, this.translator.getTranslatedMessage(message));
}
/**
@ -135,8 +139,12 @@ public final class StringFormatter {
* @param message <p>The raw message to display</p>
*/
public void displayErrorMessage(@NotNull CommandSender sender, @NotNull String message) {
if (!this.namePrefix.equals("[") || !this.nameSuffix.equals("]")) {
sender.sendMessage(getFormattedMessage(errorColor + message));
} else {
sender.sendMessage(errorColor + getFormattedMessage(message));
}
}
/**
* Replaces a placeholder in a translatable message