Bukkit/CraftBukkit — pull request #1150 by desht (2013-04-30 09:25:55+00:00)
Title: Add CraftMassBlockUpdate class.  Adds BUKKIT-4114.

## The Issue:
Bukkit's existing methods for block updates (Block.setType* and Block.setData) are slow for large number of updates due to the following reasons: 1) A block update packet is sent for every change, and 2) Lighting is recalculated for every change. This means a lot of server-side CPU load and network traffic as multiple packets are sent to every nearby player.

### Justification for this PR:
This PR adds a mechanism to efficiently update a large number of blocks without excessive packet sending, and with better control over if and how lighting recalculation is done.

### PR Breakdown:
This PR adds the CraftMassBlockUpdate class, which implements the MassBlockUpdate interface, which allows direct block changes to be made without any packet sending until all changes have been made. At that point, affected chunks are marked for refresh and will be sent by the server when it's ready. In addition, the API allows for control for if and how lighting recalculations are carried out; either immediately, never, or in a deferred manner over several ticks. Lighting recalculation is also smart; it will be done only where the light emission or light blocking of a block has changed.

### Testing Results and Materials:
See: https://github.com/desht/buster2 which includes some test data in the README for the project

See also: http://dev.bukkit.org/server-mods/ChessCraft which has been successfully using equivalent methods (implemented via direct NMS access in the plugin) for well over a year.

### Relevant PRs:
Bukkit: https://github.com/Bukkit/Bukkit/pull/867

### JIRA Tickets:
BUKKIT-4114 - https://bukkit.atlassian.net/browse/BUKKIT-4114