@@ -20,7 +20,6 @@ public class ColorAPI {
2020 private static Matcher matcher ;
2121
2222 /**
23- *
2423 * Here we can select the type of colorize,
2524 * soo if we only want RGB we do ColorizeType.RGB into input
2625 *
@@ -37,7 +36,6 @@ public static String colorizeType(ColorizeType type, String input) {
3736 }
3837
3938 /**
40- *
4139 * This method clear whole string
4240 *
4341 * @return string without patterns, legacy colors, and special chars
@@ -50,7 +48,6 @@ public static String clear(String input) {
5048 }
5149
5250 /**
53- *
5451 * In this method we remove specialChars like "&n", "&r"...
5552 * Example:
5653 * "&kForestTech ❤" -> "ForestTech ❤"
@@ -70,7 +67,6 @@ public static String removeSpecialChars(String input) {
7067 }
7168
7269 /**
73- *
7470 * In this method we remove legacyColors like "&2", "&c"...
7571 * Example:
7672 * "&2ForestTech ❤" -> "ForestTech ❤"
@@ -89,7 +85,6 @@ public static String removeLegacyColors(String input) {
8985 }
9086
9187 /**
92- *
9388 * If we want to remove patterns from message we can use this
9489 * Example:
9590 * "{#00e64e}ForestTech ❤" -> "ForestTech ❤"
@@ -105,7 +100,6 @@ public static String removePatterns(String input) {
105100 }
106101
107102 /**
108- *
109103 * Universal colorize method for add colors into message
110104 *
111105 * @param input message
@@ -118,19 +112,16 @@ public static String colorize(String input) {
118112 }
119113
120114 /**
121- *
122115 * Method for normal translate colors from spigot
123- *
124116 */
125117 public static String colorizeClassic (String input ) {
126118 input = ChatColor .translateAlternateColorCodes ('&' , input );
127119 return input ;
128120 }
129121
130122 /**
131- *
132123 * Here we can call for gradient colorize
133- *
124+ * <p>
134125 * Group 1 = First gradient
135126 * Group 3 = Second gradient
136127 * Group 2 = content
@@ -159,27 +150,25 @@ public static String colorizeGradient(String input) {
159150 }
160151
161152 /**
162- *
163153 * This method only do normal RGB without gradient
164154 *
165155 * @param input message
166156 * @return colored rgb output
167157 */
168158 public static String colorizeRGB (String input ) {
169159 matcher = patternNormal .matcher (input );
170- String color ;
160+
171161 while (matcher .find ()) {
172- color = matcher .group (1 );
173- if (color = = null ) {
174- color = matcher .group (2 );
162+ String color = matcher .group (1 );
163+ if (color ! = null ) {
164+ input = input . replace ( matcher .group (), getColor ( color ) + "" );
175165 }
176- input = input .replace (matcher .group (), getColor (color ) + "" );
177166 }
167+
178168 return input ;
179169 }
180170
181171 /**
182- *
183172 * Color method for gradient for example this take
184173 * the first one gradient, and second one, and do gradient in the message
185174 *
@@ -219,9 +208,7 @@ private static String apply(String input, ChatColor[] colors) {
219208 }
220209
221210 /**
222- *
223211 * @return colors for string
224- *
225212 */
226213 private static ChatColor [] createGradient (Color first , Color second , int amount ) {
227214 ChatColor [] colors = new ChatColor [amount ];
0 commit comments