Okay so i have noticed there's no way to prevent players from pvping in singleplayer server, so please can we add a way to turn pvp off.
i have found a temporary fix.
step 1. do /team add (name)
step 2. /team modify (name) friendlyfire false
Step 3. setup a command block that is always active and repeats and put it in in the world spawn chunk and make the command /team join (name) @a