For reasons unknown I cannot quite conceptualize how to move past a huge glaring flaw one of my projects had a few months ago that I've yet to fix.
Each explosive, projectile, and structure (all of which are /objs) had a variable called owner. It contained a reference to the mob that created them. It was through this variable that these things inferred what to do if say... the owner was on red team, and a blue team guy attacked a structure he made.
if(owner.team != team) etc.
A problem that arose that I never considered was the fact if a player logged out, that reference vanished, so any interaction with something that needed to refer to owner or a variable of owner's would just spew runtime errors.
Another HUGE problem was that players could switch teams mid-round, which just swapped their icon colour and added them to the other team. It did not however make any difference towards owner; I could be on red team and build a bunch of stuff, plant a few mines, then join blue team and be immune to the red mines that I made and be able to interact with the red buildings, which was not the intended behaviour.
After the fact I considered a few ways to fix this, though none of them seemed applicable. Among those were deleting everything that mob made if they left/switched teams, but this had severe implications on balance and possible griefing.
For the life of me I can't figure out a better way to handle this at all. The idea is that lasers and bombs do damage to things based on if they're on the same team, and structures can only be damaged by people on the opposite team.