This short & simple plugin for Spigot and Bukkit servers blocks users from executing /difficulty peaceful
through the chat, console and command blocks.
This prevents someone from accidentally causing mobs to despawn which can for example destroy farms using nametagged mobs.
Download the .jar: https://github.com/3urobeat/noPeacefulPlugin/releases/latest
...and put it into the plugins
folder of your Spigot/Bukkit server. Done!
This plugin was tested on 1.16 - 1.20 but should also work on other versions.