Knicks center Joakim Noah has rarely found himself on the court in the second year of a four-year, $72 million deal. And there’s no easy escape from New York. (Tony Gutierrez/AP, File)

Two summers ago, the NBA found itself in an unprecedented situation, as a massive one-time spike in the salary cap left virtually every team with gobs of money to spend.

And, like a Las Vegas bachelor party flush with cash, those teams spent. And spent. And spent.

Only one franchise — the Golden State Warriors — emerged from the summer of 2016 with a super team that still looks capable of ruling the NBA beyond this decade, landing Kevin Durant without having to sacrifice Stephen Curry, Klay Thompson or Draymond Green. Virtually every other team found itself saddled with at least one burdensome contract that has only grown worse with time.

The ramifications of that reckless spending will impact how the league operates for years to come.

Players hitting free agency this summer will be looking at the money players made in past years — particularly in 2016 — and expecting it to be there for them, too. It won’t be. There are currently only eight teams projected to have more than $20 million in cap room this summer. At least two of them, the Chicago Bulls and Atlanta Hawks, aren’t expected to spend big in free agency. Another, the Los Angeles Clippers, won’t have any room if DeAndre Jordan opts into the $24.1 million he’s owed next year. Given the lack of cap room around the league, it would likely be prudent of Jordan to do so.

That leaves only five teams — the Los Angeles Lakers, Philadelphia 76ers, Indiana Pacers, Dallas Mavericks and Phoenix Suns — with money to make a big splash in free agency, not a lot of options for the many free agents who will be hitting the market.

Meanwhile, as many as half the teams in the NBA could find themselves paying the luxury tax next season — and, in some cases, being significantly above the tax line. That includes franchises in smaller markets such as the New Orleans Pelicans, Denver Nuggets, Milwaukee Bucks and Oklahoma City Thunder — assuming they can each re-sign their star free agent (DeMarcus Cousins, Nikola Jokic, Jabari Parker and Paul George, respectively).

In a typical season, five luxury tax-paying teams is standard. Next season, the number could triple, which will have ripple effects on how teams around the league are willing to conduct business.

Both players and teams are already feeling the repercussions of that summer of 2016, and they’ll only become more pronounced as time goes by.

Just ask Joakim Noah and Luol Deng, and their current franchises, the New York Knicks and Lakers. In what feels like a lifetime ago, Noah and Deng helped form the backbone of Chicago Bulls teams that looked like title contenders at the start of this decade. Now, Noah and Deng symbolize the league’s finances going haywire in 2016, and how it will take years to fully recover.

Despite plying their trades on opposite coasts, the players are in the same predicament: Locked in the second year of a four-year, $72 million deal that the Knicks and Lakers would love to unload but almost certainly cannot.

Noah and Deng are essentially on leave from their current teams, and all sides would gladly welcome divorces. The Knicks and Lakers would open up another $18 million in cap space, while Deng and Noah could sign with contending teams, if they desired. For that to happen, though, one side would have to do something unpalatable.

The players would need to give back some of the roughly $40 million in guaranteed money that they are owed over the next two-and-a-half years. To trade either Noah or Deng, the Knicks or Lakers would have to give up assets. None of the parties has interest in making such concessions.

The result is both players and teams are stuck in marriages they don’t want but can’t escape.

This problem applies to other teams, as well. It will not only have an impact on what happens between now and next Thursday’s trade deadline, but also on how teams approach this summer and beyond.

Think the Washington Wizards would like a mulligan on Ian Mahinmi’s four-year, $64 million contract? How about the Memphis Grizzlies giving $94 million to Chandler Parsons, who has basically been injured from the moment he arrived? The Portland Trail Blazers gave Evan Turner $70 million and re-signed restricted free agents Meyers Leonard, Maurice Harkless and Allen Crabbe with a combined $155 million in guaranteed money — all on four-year deals. The Orlando Magic are saddled with Bismack Biyombo’s four-year, $72 million deal. The Charlotte Hornets have considered trading all-star Kemba Walker in part because they have three players who were signed that summer — Nicolas Batum, Dwight Howard (acquired in a trade with the Hawks this past summer) and Marvin Williams — who will make a combined $59 million next season alone.

At least one bad 2016 contract is lingering on the books of just about every NBA team these days, and they’ll gum up the works until they can completely work their way through the system.

This could have been avoided. When the television deal was agreed to, the league went to the National Basketball Players Association and asked to “smooth” the money into the system. Essentially, instead of having the cap dramatically spike in one season, the NBA wanted to ease it in over time to try to prevent such a jarring jolt to its finances. The players rejected the deal, preferring to have the money they were owed arrive all at once.

It did, leaping $24 million in a single season, and following teams’ spending spree, the league hasn’t recovered.

The worst hangover in NBA history is nowhere near over. The pain has only just begun.

Read more on the NBA:

Former NBA player Rasual Butler and his wife killed in car crash

After John Wall’s surgery, doctors provide a glimpse of what his recovery could look like

Kevin Love’s injury will put the spotlight squarely on Isaiah Thomas’s struggles

The Cavs’ offense wasn’t the problem. With Kevin Love out, it might become one.

Pistons are hoping Blake Griffin can take them to the next level. He probably won’t.