Harrison Barnes scored a season-high 28 points as the Dallas Mavericks beat the Brooklyn Nets 119-113.