Bukkit/Bukkit — pull request #951 by Deathfish3 (2013-11-09 14:35:57+00:00)
Title: [B] Makes Pumpkins, Melons, Carrots and Potatoes extend Crops. Adds BUKKIT-4780, BUKKIT-4781

The Issue:
With the recent deprecation of getData and setData, there is no forwards compatible way of accessing the growth state of Pumpkins, Melons, Carrots and Potatoes.

Justification for this PR:
Provides a common interface for accessing the growth state of all farmable plants in a non-deprecated way.

As they are all farmable plants with 8 stages of growth, it seems reasonable to make them extend Crops, rather than requiring separate growth state enums and MaterialData classes for each type of plant (which would be another viable alternative to avoiding the use of these depracated magic values).

PR Breakdown:
By making the Materials for these plants extend the Crops class, this allows users to get and set their growth values using the same CropState enum that wheat uses.

Testing Results and Materials:
Tested using a trivial plugin to check that the block.getState().getData() returns a Crops object for the relevant plants as well as wheat. Link to the plugin jar and source:
https://drive.google.com/file/d/0B5UQpct4CwlTUkFaR2VtaDVZYXc/edit?usp=sharing
The player is given seeds, a hoe, and some bonemeal on login, and right clicking on a planted block of each crop will display a message about the growth state of that crop.

JIRA Tickets:
https://bukkit.atlassian.net/browse/BUKKIT-4780
https://bukkit.atlassian.net/browse/BUKKIT-4781 .