Bukkit/Bukkit — pull request #919 by shjohnson-pi (2013-08-23 03:27:06+00:00)
Title: [B+C] Add block state to BlockFromToEvent. Used to add BUKKIT-2374

**The Issue:**

Plugins can't stop infinite water sources. (2x2 area of water sources never depletes)
When water flows and sends a BlockFromToEvent there is no data about the changed
data value (generally decreased by 1 for water). Plugins can't tell if water is just flowing
or if a new source block is created.

**Justification for this PR:**

BlockFromToEvent now includes the new block state, so plugins can
see exactly what will happen.

**PR Breakdown:**

Changed constructors of BlockFromToEvent to include BlockStates

**Plugin Example:**

```javascript
@EventHandler
public void onBlockFromTo(BlockFromToEvent event) {
Block block = event.getBlock();
Block toBlock = event.getToBlock();
BlockState newState = event.getNewState();

if (newState.getType() == Material.STATIONARY_WATER || newState.getType() == Material.WATER) {
if (newState.getRawData() == 0) // Source block
{
event.setCancelled(true);
plugin.getLogger().info("Canceled water duplication event");
}
}
}
```

**Relevant PR(s):**

CraftBukkit side of this PR
CB-1167 https://github.com/Bukkit/CraftBukkit/pull/1167

(By ticket creator Ben Stern, results in 404)
https://github.com/Bukkit/CraftBukkit/pull/877

**JIRA Ticket:**

BUKKIT-2374 - https://bukkit.atlassian.net/browse/BUKKIT-2374