Global GameRules Mod (1.18.2, 1.1.5) allows global GameRules to be applied when a world has been loaded. Locking the difficulty allows for default world difficulty to be set when the 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.