VanillaDev/Vanilla — pull request #467 by Hidendra (2013-01-02 18:55:47+00:00)
Title: Refresh the client when broken blocks are cancelled via an interact event

Hello again

Currently when you break a block a `PlayerInteractEvent` is thrown and if this is not cancelled a `BlockChangeEvent` will be thrown (signalling the block break). This assumes instant break. In the event of normal digging, `PlayerInteractEvent` is thrown when started and a `BlockChangeEvent` is thrown once it finally breaks. This is of course as expected.

However in both of these cases if the `PlayerInteractEvent` is cancelled, the player will most likely be left with a broken block in their client. The server should send the correct block back to the client upon failure of breaking the block.

This commit sends the block back to the client under 2 circumstances:

* In the `STATE_START_DIGGING` dig state, when the `PlayerInteractEvent` is cancelled **AND** the block is instantly breakable (creative or hardness = 0)
* In the `STATE_DONE_DIGGING` dig state, when the digging check fails **AND** the server sees the player as not currently digging (e.g the `PlayerInteractEvent` from `STATE_START_DIGGING` was cancelled!)

This has been confirmed to work as one would expect in both creative (instantly breaking blocks) and survival modes (digging).