File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
src/main/java/cz/foresttech/api Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 66
77 <groupId >cz.foresttech</groupId >
88 <artifactId >ForestColorAPI</artifactId >
9- <version >1.5</version >
9+ <version >1.5.1 </version >
1010
1111 <properties >
1212 <maven .compiler.source>17</maven .compiler.source>
Original file line number Diff line number Diff line change @@ -156,16 +156,23 @@ public static String colorizeGradient(String input) {
156156 * @return colored rgb output
157157 */
158158 public static String colorizeRGB (String input ) {
159- matcher = patternNormal .matcher (input );
159+ Matcher matcher = patternNormal .matcher (input );
160+ StringBuilder result = new StringBuilder (input .length ());
160161
162+ int lastEnd = 0 ;
161163 while (matcher .find ()) {
162164 String color = matcher .group (1 );
165+ result .append (input , lastEnd , matcher .start ());
166+
163167 if (color != null ) {
164- input = input . replace ( matcher . group (), getColor (color ) + "" );
168+ result . append ( getColor (color ));
165169 }
170+
171+ lastEnd = matcher .end ();
166172 }
167173
168- return input ;
174+ result .append (input .substring (lastEnd ));
175+ return result .toString ();
169176 }
170177
171178 /**
You can’t perform that action at this time.
0 commit comments