Global GameRules Mod (1.19.2, 1.18.18) allows global GameRules to be applied when a world has been loaded. It also allows for the default world difficulty to be set when a world is loaded. It is impossible to unlock a world’s difficulty again after it has been locked. When a world is locked, its difficulty will not change. When a world is loaded, it applies any changes to the GameRules and the difficulty to that world.
World loads are affected by any changes made to config files or in-game configuration gui.