There are tutorials for this. But the commands for right-clicking and destruction are blockActivate() and onBlockDestroyed() or something like that. Then you can reverse the process for creating something and set it to destroy stuff.
Rollback Post to RevisionRollBack
Has nice day!
Please no PMing, and no, I'm not a moderator.