/** * Moves Player towards or * away from a location * * @param source player * @param target location * @param inOrOut testing * @param strength how fast you go */ public static void corDir(Player source, Location target, int inOrOut, int strength){ Location l = source.getLocation(); Vector v = l.toVector().subtract(target.toVector()).multiply(inOrOut).normalize(); source.setVelocity(new Location(l.getWorld(),l.getX(),l.getY(),l.getZ(),(180-(float)Math.toDegrees(Math.atan2(v.getX(), v.getZ()))),(90-(float)Math.toDegrees(Math.acos(v.getY())))).getDirection().multiply((l.distance(target)/strength))); //Line for the error }