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,7 +115,11 @@ public final class StringFormatter {
* @param message <p>The raw message to display</p>
*/
public void displaySuccessMessage(@NotNull CommandSender sender, @NotNull String message) {
sender.sendMessage(successColor + getFormattedMessage(message));
if (!this.namePrefix.equals("[") || !this.nameSuffix.equals("]")) {
sender.sendMessage(getFormattedMessage(successColor + message));
} else {
sender.sendMessage(successColor + getFormattedMessage(message));
}
}
/**
@ -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,7 +139,11 @@ public final class StringFormatter {
* @param message <p>The raw message to display</p>
*/
public void displayErrorMessage(@NotNull CommandSender sender, @NotNull String message) {
sender.sendMessage(errorColor + getFormattedMessage(message));
if (!this.namePrefix.equals("[") || !this.nameSuffix.equals("]")) {
sender.sendMessage(getFormattedMessage(errorColor + message));
} else {
sender.sendMessage(errorColor + getFormattedMessage(message));
}
}
/**