I've been playing the game for a little while already, and this hasn't happened until now. Suddenly, I can't dig certain blocks like sand, dirt, gravel, cobblestone, bookshelves, and cacti. I can, however, dig through leaves with a sword equipped. Any suggestions?
You have changed your gamemode to adventure. Adventure mode is used to play adventure maps (you can only break blocks with specific tools.)
To fix press esc. press open to LAN, choose enable cheats. Open the lan world. now press t (to open op chat) and type in:
/gamemode 0 this will set your gamemode to survival, and should fix it.