Given that plugins like YEP_EventSpawner save spawned events on the map itself, I was hoping for a way to clone maps into a new map ID during runtime. This would avoid some of the trouble of managing complex arrays for reconstructing data.
I don't know on a technical level how this plugin would work. I'm hoping its as simple as the plugin storing the "mother" map's ID and the "daughter" map's ID, per map generated this way, and then referencing those when entering the map.
Is there a way to do this? And have YEP_EventSpawner still work?
Cloning data objects is totally possible and not hard (I'm doing it in a WIP enchantment plugin), but maps are another story altogether. The problem with maps is that they essentially don't exist unless you're on them. So, there isn't a clear way to assign an ID to a cloned map.
Perhaps it would help if you explain your requirements in a bit more detail. Maybe there's a way that avoids the need to clone maps, or even if there isn't, it might help us to figure out what "cloning a map" means exactly for your problem.
Unfortunately, I don't know how EventSpawner works and can't see the code, so it's difficult to answer that question. It's likely possible. For example, if you wanted built-in self switches to recognize instances as separate maps, I think it wouldn't be that difficult to achieve – I recently did something like this.
But there still may be other approaches to consider… for example, are there a fixed number of clones for each map? To put it another way, is it something that theoretically could be handled by manually making N copies of each map and slightly tweaking each one? I don't mean to suggest that this is an approach you should try (if you have 50 maps, each of which have 100 variations, it's clearly not practical), but if the scenario is such that you could in principle do it, then that knowledge would help for working out a less tedious method to obtain the same effect.