I intend to build an escape map and for this I need a command with which, for example:
Can modify a lever so that it can only be placed on a specific block.
Is that possible?
Yes, to do this you have to put the player in gamemode 2 and change the gamerule etc. I don't know exactly how it works either, but you can google that.
With NBT tags, yes.
To do this, you use the special adventure mode. You can't build or dismantle anything there. You can now modify items with commands. Here is an example:
/ give @p lever {CanPlaceOn: [red_wool]}
It works with several things
/ give @p acacia_button {CanPlaceOn: [gray_wool, white_wool]}
If you want to break something down now, it works like this:
/ give @p wooden_pickaxe {CanDestroy: [oak_log]}
Even with several:
/ give @p diamond_axe {CanDestroy: [gray_wool, green_wool]}
Have fun creating your map, Erik
PS: Have a look at GamerGeeks.nz, there's a generator for these commands.
Just what I was looking for. Super.