diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/TextComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/TextComponent.java index 2f808a85..694719c8 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/TextComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/TextComponent.java @@ -28,6 +28,21 @@ public final class TextComponent extends BaseComponent * @return the components needed to print the message to the client */ public static BaseComponent[] fromLegacyText(String message) + { + return fromLegacyText( message, ChatColor.WHITE ); + } + + /** + * Converts the old formatting system that used + * {@link net.md_5.bungee.api.ChatColor#COLOR_CHAR} into the new json based + * system. + * + * @param message the text to convert + * @param defaultColor color to use when no formatting is to be applied + * (i.e. after ChatColor.RESET). + * @return the components needed to print the message to the client + */ + public static BaseComponent[] fromLegacyText(String message, ChatColor defaultColor) { ArrayList components = new ArrayList(); StringBuilder builder = new StringBuilder(); @@ -79,7 +94,7 @@ public final class TextComponent extends BaseComponent component.setObfuscated( true ); break; case RESET: - format = ChatColor.WHITE; + format = defaultColor; default: component = new TextComponent(); component.setColor( format );