@@ -55,35 +55,39 @@ public static MutableText fromString(String message) {
5555 public static String toFormattedString (Text message ) {
5656 StringBuilder result = new StringBuilder ();
5757
58- Style style = message .getStyle ();
58+ if (message .getSiblings ().isEmpty ()){
59+ Style style = message .getStyle ();
5960
60- String format = "" ;
61+ String format = "" ;
6162
62- if (style .getColor () != null ) {
63- format += "§x§" + String .join ("§" , String .format ("%06X" , style .getColor ().getRgb ()).split ("" ));
64- }
65-
66- if (style .isBold ()) {
67- format += "§l" ;
68- }
69- if (style .isItalic ()) {
70- format += "§o" ;
71- }
72- if (style .isUnderlined ()) {
73- format += "§n" ;
74- }
75- if (style .isStrikethrough ()) {
76- format += "§m" ;
77- }
78- if (style .isObfuscated ()) {
79- format += "§k" ;
80- }
63+ if (style .getColor () != null ) {
64+ format += "§x§" + String .join ("§" , String .format ("%06X" , style .getColor ().getRgb ()).split ("" ));
65+ }
8166
82- result .append (format );
83- result .append (message .getString ());
67+ if (style .isBold ()) {
68+ format += "§l" ;
69+ }
70+ if (style .isItalic ()) {
71+ format += "§o" ;
72+ }
73+ if (style .isUnderlined ()) {
74+ format += "§n" ;
75+ }
76+ if (style .isStrikethrough ()) {
77+ format += "§m" ;
78+ }
79+ if (style .isObfuscated ()) {
80+ format += "§k" ;
81+ }
8482
85- for (Text sibling : message .getSiblings ()) {
86- result .append (toFormattedString (sibling ));
83+ result .append (format );
84+ result .append (message .getString ());
85+ }
86+ else {
87+ for (Text sibling : message .getSiblings ()) {
88+ result .append ("§r" );
89+ result .append (toFormattedString (sibling ));
90+ }
8791 }
8892
8993 return result .toString ();
0 commit comments