MassiveCraft/mcore — pull request #62 by OniBait (2013-11-13 07:53:38+00:00)
Title: Add gson type factory adapter to handled modded enums

Added a EnumTypeAdapter (w/ Factory) and registered it Gson that it properly handles modified Java Enums.

### Problem:
The problem that was occurring is Forge modifies Vanilla Minecraft Enums (see https://github.com/MinecraftForge/MinecraftForge/blob/master/common/net/minecraftforge/common/EnumHelper.java) -- the way that it modifies the Enum is pure Java hackery modifying $VALUES on the underlying Enum. This will update the calls to `Class.getEnumContants` but won't update any fields on the Enum. So when the built-in Gson `EnumTypeAdaper` tries to see if any `SerializedName` annotations are on the fields of the Enum, it can't find a field with the new names and throws an exception.

### Reasoning:
There is really not any way that we could put any fix in on the MCPC+ side (and if you ever did a Forge port, you'd need this code for that as well) since we can't add fields to Java enums at runtime.

### Solution:
This `ModdedEnumTypeAdapter` is basically just a straight copy of the built-in one, but ignores when it can't find the field/annotation (which is the desired behavior in this case anyways).

I tested this with Factions on the latest MCPC+ release and it resolves the issue that was logged. Hopefully this will reduce the number of people opening issues on both sides. If you have any questions, feel free to hit me up on IRC.