Go to the game configuration and navigate to “Basic Config” and “Game Settings”.
In the line “Difficulty”, set the desired difficulty level and save.
Go to the game configuration and navigate to “Configuration Files” and “server.properties”.
Change the variable difficulty= to the desired value and save.
Values for the variable difficulty in BEDROCK Edition: