Bukkit/CraftBukkit — pull request #1067 by evilmidget38 (2013-03-18 06:27:33+00:00)
Title: [B+C] BlockState for Command Blocks. Adds BUKKIT-3805

The Issue:

Currently in Bukkit there is no method whatsoever to modify the command or name of a Command Block.

Justification for this PR:

Currently in Bukkit there is no way to modify, much less retrieve either the command or the name of Command Blocks. This issue is particularly damaging to plugins such as WorldEdit, which attempt to copy and paste blocks, but face particular trouble with the inability to copy these values over using purely the bukkit API. Other plugins, such as any logging plugin really, also face the issue of being unable to correctly replace blocks, which is a bit of a pain for the end user.

PR Breakdown:

Changes to NMS, are rather minimal, being composed entirely of changing TileEntityCommand#b to public. This is necessary as NMS lacks an accessor for for the command. This is not the case with the name("c"), so no changes were made to it.

A two line change was made to CraftBlock#getState() to return a CommandBlock when the block's material is Material.COMMAND.

The implementation of CommandBlock was added in the form of CraftCommandBlock, which is a wrapper for a TileEntity(TileEntityCommand, in this case), similar to any of the other BlockStates.

Relevant PR(s):

B-803 - https://github.com/Bukkit/Bukkit/pull/803 - Bukkit API addition for the BlockState for Command Blocks.
CB-#### - https://github.com/Bukkit/CraftBukkit/pull/#### - CraftBukkit Implementation of the new API.

JIRA Ticket:

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