From 863379742022e567dca6b66cbcd711b49a20391a Mon Sep 17 00:00:00 2001 From: LeoDog896 Date: Fri, 15 Jan 2021 13:16:09 -0500 Subject: [PATCH] Use a StringBuilder for ColoredText --- src/main/java/net/minestom/server/chat/ColoredText.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/chat/ColoredText.java b/src/main/java/net/minestom/server/chat/ColoredText.java index 394780a6e..0a9a7760b 100644 --- a/src/main/java/net/minestom/server/chat/ColoredText.java +++ b/src/main/java/net/minestom/server/chat/ColoredText.java @@ -20,7 +20,7 @@ import java.util.regex.Pattern; public class ColoredText extends JsonMessage { // the raw text - private String message; + private StringBuilder message = new StringBuilder(); /** * Creates a colored text. @@ -31,7 +31,7 @@ public class ColoredText extends JsonMessage { * @see #of(String) to create a colored text */ private ColoredText(@NotNull String message) { - this.message = message; + this.message.append(message); refreshUpdate(); } @@ -79,7 +79,7 @@ public class ColoredText extends JsonMessage { */ @NotNull public ColoredText append(@NotNull ChatColor color, @NotNull String message) { - this.message += color + message; + this.message.append(color).append(message); refreshUpdate(); return this; } @@ -116,7 +116,7 @@ public class ColoredText extends JsonMessage { */ @NotNull public String getMessage() { - return message; + return message.toString(); } /**