From 3fa95d82a65b960f70c2a8c174e04c19e2d416b5 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 1 Oct 2021 10:34:47 +0100 Subject: [PATCH] Fixed gradient div by zero exception --- eco-api/src/main/java/com/willfp/eco/util/StringUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eco-api/src/main/java/com/willfp/eco/util/StringUtils.java b/eco-api/src/main/java/com/willfp/eco/util/StringUtils.java index cb11ae63..58a43e92 100644 --- a/eco-api/src/main/java/com/willfp/eco/util/StringUtils.java +++ b/eco-api/src/main/java/com/willfp/eco/util/StringUtils.java @@ -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);