diff --git a/smylib/core/src/main/java/net/smyler/smylib/text/PlainTextContent.java b/smylib/core/src/main/java/net/smyler/smylib/text/PlainTextContent.java index 1f4f1ddd..527af91e 100644 --- a/smylib/core/src/main/java/net/smyler/smylib/text/PlainTextContent.java +++ b/smylib/core/src/main/java/net/smyler/smylib/text/PlainTextContent.java @@ -18,7 +18,7 @@ public final class PlainTextContent implements TextContent { * @throws NullPointerException if content is null */ public PlainTextContent(@NotNull String content) { - this.content = requireNonNull(content); + this.content = requireNonNull(content).replace("" + Formatting.PREFIX, ""); } @Override diff --git a/smylib/core/src/main/java/net/smyler/smylib/text/TextContent.java b/smylib/core/src/main/java/net/smyler/smylib/text/TextContent.java index 5541ff1e..e316e4c5 100644 --- a/smylib/core/src/main/java/net/smyler/smylib/text/TextContent.java +++ b/smylib/core/src/main/java/net/smyler/smylib/text/TextContent.java @@ -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 */ diff --git a/smylib/core/src/main/java/net/smyler/smylib/text/TranslatableTextContent.java b/smylib/core/src/main/java/net/smyler/smylib/text/TranslatableTextContent.java index b71a66de..88f9b89b 100644 --- a/smylib/core/src/main/java/net/smyler/smylib/text/TranslatableTextContent.java +++ b/smylib/core/src/main/java/net/smyler/smylib/text/TranslatableTextContent.java @@ -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, ""); } }