Skip to content

Commit

Permalink
Strip formatting chars from text content
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC committed May 13, 2024
1 parent bbb80c2 commit e97d859
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class PlainTextContent implements TextContent {
* @throws NullPointerException if content is <code>null</code>
*/
public PlainTextContent(@NotNull String content) {
this.content = requireNonNull(content);
this.content = requireNonNull(content).replace("" + Formatting.PREFIX, "");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public interface TextContent {

/**
* Resolves this text content as a String.
* The result should not contain formatting characters.
*
* @return this text content as a string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public String toString() {
Object[] with = this.with.stream()
.map(Text::getUnformattedText)
.toArray(String[]::new);
return translator.format(this.translationKey, with);
return translator.format(this.translationKey, with).replace("" + Formatting.PREFIX, "");
}
}

0 comments on commit e97d859

Please sign in to comment.