Make line from particles

Hi, it’s me again.
I am making plugin that adds Medigun to game, and just a question - how to make line with particles (not like in TF2, but just straight line from Location A to B? I have everything, but not way to make this line.

A little mathy, not sure if you wanted to take y into account, so this one doesnt, if you want to account for x,y and z, then take a look at this algorithm.

public void drawLine(World world, Vector3d pos1, Vector3d pos2){
    double xDiff = pos2.getX() - pos1.getX();
    double zDiff = pos2.getZ() - pos2.getZ();
    double xAbs = Math.abs(xDiff);
    double zAbs = Math.abs(zDiff);
    double steps = xAbs;
    if(xAbs <= zAbs){
        steps = zAbs;
    double xInc = xDiff / steps;
    double zInc = zDiff / steps;

    double x = pos1.getX();
    double z = pos1.getZ();

    for(int s = 0; s < steps; s++){
        x = x + xInc;
        z = z + zInc;
        //create particle with variable 'x' and 'z'