@@ -61,10 +61,10 @@ public static Component parseText(String input) {
6161 // 1. Normalize section sign to ampersands
6262 String normalized = input .replace ('§' , '&' );
6363
64- // 2. Convert nibble hex (&x&F&F&0&0&0&A) -> <#FF000A>
64+ // 2. Convert nibble hex (&x&F&F&0&0&0&A) -> <reset>< #FF000A>
6565 normalized = convertNibbleHex (normalized );
6666
67- // 3. Convert hash hex (&#FF00AA) -> <#FF00AA>
67+ // 3. Convert hash hex (&#FF00AA) -> <reset>< #FF00AA>
6868 normalized = convertHashHex (normalized );
6969
7070 // 4. Convert legacy color and format codes to MiniMessage tags
@@ -81,7 +81,7 @@ public static Component parseText(String input) {
8181 try {
8282 component = MINI .deserialize (normalized );
8383 } catch (Exception ex ) {
84- // Fallback: do pure legacy parse on the original normalized (before conversions could be stored separately if desired)
84+ // Fallback: do pure legacy parse
8585 component = LegacyComponentSerializer .legacyAmpersand ().deserialize (input .replace ('§' , '&' ));
8686 }
8787 } else {
@@ -99,13 +99,14 @@ private static String convertHashHex(String s) {
9999 StringBuffer sb = new StringBuffer ();
100100 while (m .find ()) {
101101 String hex = m .group (1 ).toUpperCase ();
102- m .appendReplacement (sb , "<#" + hex + ">" );
102+ // Color codes in legacy reset formatting; ensure we reset before applying color
103+ m .appendReplacement (sb , "<reset><#" + hex + ">" );
103104 }
104105 m .appendTail (sb );
105106 return sb .toString ();
106107 }
107108
108- // Convert &x&R&R&G&G&B&B sequences to <#RRGGBB>
109+ // Convert &x&R&R&G&G&B&B sequences to <reset>< #RRGGBB>
109110 private static String convertNibbleHex (String s ) {
110111 StringBuilder out = new StringBuilder (s .length ());
111112 int i = 0 ;
@@ -120,7 +121,7 @@ && isNibbleSequence(s, i)) {
120121 for (int off = 3 ; off <= 13 ; off += 2 ) {
121122 hex .append (s .charAt (i + off ));
122123 }
123- out .append ("<#" ).append (hex .toString ().toUpperCase ()).append (">" );
124+ out .append ("<reset>< #" ).append (hex .toString ().toUpperCase ()).append (">" );
124125 i += 14 ;
125126 } else {
126127 out .append (s .charAt (i ));
@@ -157,17 +158,17 @@ private static String convertLegacyCodesToTags(String s) {
157158 if (c == '&' && i + 1 < s .length ()) {
158159 char code = Character .toLowerCase (s .charAt (i + 1 ));
159160
160- // Formatting
161+ // Formatting codes (&l, &o, &n, &m, &k, &r)
161162 if (FORMAT_TAGS .containsKey (code )) {
162163 String tag = FORMAT_TAGS .get (code );
163164 out .append ('<' ).append (tag ).append ('>' );
164165 i ++;
165166 continue ;
166167 }
167- // Color
168+ // Color codes (&0..&f) should reset previous formatting
168169 if (COLOR_TAGS .containsKey (code )) {
169170 String tag = COLOR_TAGS .get (code );
170- out .append ('<' ).append (tag ).append ('>' );
171+ out .append ("<reset>" ). append ( '<' ).append (tag ).append ('>' );
171172 i ++;
172173 continue ;
173174 }
0 commit comments