Skip to content

Commit db20b5b

Browse files
author
boiscljo
committed
Remove the reassigning the parameters
1 parent 5fa1e55 commit db20b5b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/java/com/iridium/iridiumcolorapi/IridiumColorAPI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ public static String color(@Nonnull String string, @Nonnull Color start, @Nonnul
136136
@Nonnull
137137
public static String rainbow(@Nonnull String string, float saturation) {
138138
String originalString = string;
139-
string = withoutSpecialChar(string);
140139

141-
ChatColor[] colors = createRainbow(string.length(), saturation);
140+
ChatColor[] colors = createRainbow(withoutSpecialChar(string).length(), saturation);
142141
return apply(originalString, colors);
143142
}
144143

@@ -193,12 +192,13 @@ private static String apply(@Nonnull String source, ChatColor[] colors) {
193192

194193
@Nonnull
195194
private static String withoutSpecialChar(@Nonnull String source) {
195+
String workingString = source;
196196
for (String color : SPECIAL_COLORS) {
197-
if (source.contains(color)) {
198-
source = source.replace(color, "");
197+
if (workingString.contains(color)) {
198+
workingString = workingString.replace(color, "");
199199
}
200200
}
201-
return source;
201+
return workingString;
202202
}
203203

204204
/**

0 commit comments

Comments
 (0)