diff --git a/src/main/java/eu/milujukockoholky/vexliolobby/utility/color/IridiumColorAPI.java b/src/main/java/eu/milujukockoholky/vexliolobby/utility/color/IridiumColorAPI.java index 76a16a9..45b5727 100644 --- a/src/main/java/eu/milujukockoholky/vexliolobby/utility/color/IridiumColorAPI.java +++ b/src/main/java/eu/milujukockoholky/vexliolobby/utility/color/IridiumColorAPI.java @@ -171,6 +171,9 @@ public class IridiumColorAPI { */ private static ChatColor[] createRainbow(int step, float saturation) { ChatColor[] colors = new ChatColor[step]; + if (step <= 0) { + return colors; + } double colorStep = (1.00 / step); for (int i = 0; i < step; i++) { Color color = Color.getHSBColor((float) (colorStep * i), saturation, saturation); @@ -194,6 +197,13 @@ public class IridiumColorAPI { */ private static ChatColor[] createGradient(Color start, Color end, int step) { ChatColor[] colors = new ChatColor[step]; + if (step <= 0) { + return colors; + } + if (step == 1) { + colors[0] = SUPPORTS_RGB ? ChatColor.of(start) : getClosestColor(start); + 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);