From 4474c4354cb600b9f99ca2db77139224c7e6a97e Mon Sep 17 00:00:00 2001 From: Esophose Date: Tue, 25 Aug 2020 18:44:53 -0600 Subject: [PATCH] Fix off by 1 for hex colors when stopping at end of string --- .../java/dev/esophose/playerparticles/util/HexUtils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/esophose/playerparticles/util/HexUtils.java b/src/main/java/dev/esophose/playerparticles/util/HexUtils.java index 38cc2cd..257a040 100644 --- a/src/main/java/dev/esophose/playerparticles/util/HexUtils.java +++ b/src/main/java/dev/esophose/playerparticles/util/HexUtils.java @@ -154,7 +154,7 @@ public final class HexUtils { if (matcher.start() > searchAfter) return matcher.start(); } - return content.length() - 1; + return content.length(); } private static String cleanHex(String hex) { @@ -270,6 +270,9 @@ public final class HexUtils { this.step = this.stepIndex = 0; } + /** + * @return the next color in the gradient + */ public Color next() { // Gradients will use the first color of the entire spectrum won't be available to preserve prettiness if (NMSUtil.getVersionNumber() < 16) @@ -344,6 +347,9 @@ public final class HexUtils { this(totalColors, 1.0F, 1.0F); } + /** + * @return the next color in the gradient + */ public Color next() { Color color = Color.getHSBColor(this.hue, this.saturation, this.brightness); this.hue += this.hueStep;