Hmmm, yeah, that’s because getMappings() returns an unmodifiable view for the list of mappings. So adding a mapping to this list won’t work. But you could use setMappings() to work around this. Just retrieve the current list of mappings and construct a new list which also contains the new mapping. Than use setMappings() to set the new mapping list.
I know that this isn’t a very nice solution, but it should work. Adding mappings dynamically is a very rare usecase nobody thought of while building the API back then.
Do you play Magic?
Get TopDecked MTG, the #1 Magic App, built by players, for players. Free to use, forever.