A teenager who was planning a mass shooting at his old primary school has been jailed for life with a minimum term of 49 years for murdering his family.