package in.twizmwaz.cardinal.module.modules.arrows;

import in.twizmwaz.cardinal.util.MiscUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.entity.Arrow;

public class ArrowRunnable implements Runnable {

    private final Arrow arrow;
    private final float x;
    private final float y;
    private final float z;

    private Integer taskId = null;

    protected ArrowRunnable(Arrow arrow, ChatColor chatColor) {
        this.arrow = arrow;
        Color rgb = MiscUtil.convertChatColorToColor(chatColor);
        x = (float) rgb.getRed() / 255;
        y = (float) rgb.getGreen() / 255;
        z = (float) rgb.getBlue() / 255;
    }

    public void setTask(int id) {
        this.taskId = id;
    }

    @Override
    public void run() {
        if (arrow.isOnGround() || arrow.isDead()) {
            ArrowModule.arrowOnGround(arrow);
            Bukkit.getScheduler().cancelTask(taskId);
        } else {
            ArrowModule.sendArrowParticle(arrow, x, y, z);
        }
    }

}

@@ -252,16 +252,65 @@
 able %7B%0A%0A
+    private static final float ZERO = 0.00001f;%0A%0A
     priv
@@ -619,24 +619,27 @@
     x = 
-(f
+rgbToF
 loat
-) 
+(
 rgb.getR
@@ -642,22 +642,17 @@
 getRed()
- / 255
+)
 ;%0A      
@@ -657,24 +657,27 @@
     y = 
-(f
+rgbToF
 loat
-) 
+(
 rgb.getG
@@ -682,22 +682,17 @@
 tGreen()
- / 255
+)
 ;%0A      
@@ -701,16 +701,19 @@
 z = 
-(f
+rgbToF
 loat
-) 
+(
 rgb.
@@ -721,16 +721,152 @@
 etBlue()
+);%0A    %7D%0A%0A    private static float rgbToFloat(int i) %7B%0A        if (i == 0) %7B%0A            return ZERO;%0A        %7D%0A        return (float) i
  / 255;%0A

Fix arrow particle color bugs