Bukkit/CraftBukkit — pull request #1313 by bloodmc (2014-01-06 22:30:57+00:00)
Title: Refactored BlockPlaceEvent logic to be more efficient.

### The Issue:

Currently, all block placement is being routed through ItemBlock.processBlockPlace to handle BlockPlaceEvents. The problem with this is it requires too many base edits that have caused many bugs over time.

### Justification for this PR:

Provide more efficient logic to handle all block place events. This also improves compatibility with future MC updates as many classes no longer have to be reviewed.

### PR Breakdown:

Every itemstack must go through ItemStack.placeItem before processing Item.interactWith. To take advantage of this, all block place event logic has been moved to this method. Before calling Item.interactWith, a recording flag World.captureBlocks is turned on for World.setData to capture a blockstate for each block that attempts to be set as Item.interactWith is processed. This is required for items such as ItemBed which places an extra block in world for the bed head. If a block place event is cancelled, the recorded blockstate list will be processed and each blockstate will revert back to the captured state before returning a result.

### Testing Results and Materials:
I created a simple test world with protected areas and logged on with a test client using a patched build. All block placement that I tested worked as expected. Although since this is a big change to CraftBukkit code, more testing should be done.