Bukkit/Bukkit — pull request #1109 by Pokechu22 (2014-08-24 02:17:19+00:00)
Title: [B+C] HangingType and VehicleType enums. Adds BUKKIT-5778.

##### The Issue:
There are no HangingType nor VehicleType enums.

##### Justification for this PR:
There are several places where Hanging/Vehicle enums would be useful:
- Dealing with different Hanging/Vehicles differently in events, without having to get the [EntityType](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html).
- Easy tab-completion of commands requiring a vehicle (or hanging), such as a command that only allows specific players to use, say, horses.
- Easy checking of valid values in such commands.

##### PR Breakdown:
In Bukkit:

1\. Creates [HangingType](https://github.com/Pokechu22/Bukkit/tree/BUKKIT-5778/src/main/java/org/bukkit/entity/HangingType.java) and [VehicleType](https://github.com/Pokechu22/Bukkit/tree/BUKKIT-5778/src/main/java/org/bukkit/entity/VehicleType.java) enums, containing all hangings and vehicles currently in existence.
* Constructor based off of an [EntityType](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html), meaning modifications to the base [EntityType](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html) are also applied.
* Contains methods from [EntityType](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html), as well as a method to get the corresponding [EntityType](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html).
* Contains parse method from ([BUKKIT-5777](https://bukkit.atlassian.net/browse/BUKKIT-5777)).

2\. Added `getVehicleType()` method to [Vehicle](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/Vehicle.html) and [VehicleEvent](http://jd.bukkit.org/beta/apidocs/org/bukkit/event/vehicle/VehicleEvent.html), and `getHangingType()` method to [Hanging](http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/Hanging.html) and [HangingEvent](http://jd.bukkit.org/beta/apidocs/org/bukkit/event/hanging/HangingEvent.html).

3\. Added tests for HangingType and VehicleType enums.

In CraftBukkit:

1. Added implementations of `getVehicleType()` and `getHangingType()` to the necessary classes.

##### Testing Results and Materials:
See [org.bukkit.HangingTypeTest.java](https://github.com/Pokechu22/Bukkit/tree/BUKKIT-5778/src/test/java/org/bukkit/HangingTypeTest.java) and [org.bukkit.VehicleTypeTest.java](https://github.com/Pokechu22/Bukkit/tree/BUKKIT-5778/src/test/java/org/bukkit/VehicleTypeTest.java). These tests cover the HangingType and VehicleType enums only, not the getters on the events or entities themselves.

##### Relevant PR(s):
B-1107 - https://github.com/Bukkit/Bukkit/pull/1107 - Adds a parsing method to EntityType, which I ~~stole~~ *borrowed* for use in VehicleType and HangingType. ([BUKKIT-5777](https://bukkit.atlassian.net/browse/BUKKIT-5777))

(TODO: Add partner PR when submitted)

##### JIRA Ticket:
BUKKIT-5778 - https://bukkit.atlassian.net/browse/BUKKIT-5778