Fixed gradient div by zero exception

This commit is contained in:
Auxilor
2021-10-01 10:34:47 +01:00
parent 9648b42c4d
commit 3fa95d82a6

View File

@@ -263,6 +263,9 @@ public class StringUtils {
@NotNull final Color end,
final int step) {
ChatColor[] colors = new ChatColor[step];
if (step <= 1) {
return colors;
}
int stepR = Math.abs(start.getRed() - end.getRed()) / (step - 1);
int stepG = Math.abs(start.getGreen() - end.getGreen()) / (step - 1);
int stepB = Math.abs(start.getBlue() - end.getBlue()) / (step - 1);