Bukkit/CraftBukkit — pull request #1258 by Codisimus (2013-10-18 18:46:23+00:00)
Title: [C] Make Item Attribute Modifiers ConfigurationSerializable. Adds BUKKIT-4527

The Issue

Items lose their attributes if they are stored/recovered from a
configuration serialized state.

Justification for PR

Items should keep their exact state rather than lose important
attributes. I believe this would be the next step towards creating an
attribute API.

PR Breakdown

Added, Bukkit ItemMetaKeys for attribute values [Lines 185-197]. Build
attributes from the map rather than just setting them to null [333].
Build each attribute by reading each value from the map [354-374].
hasAttributes() should also return false if the amount of attributes is
0 [465]. Serialize attributes if there are any [631-634]. Serialize
attributes be building a list of each attribute. An attribute is not
saved if any of it's values are invalid/empty [651-690]

Testing Results and Materials:

Set attributes on various items and then saved them to a config with the
following results: http://pastebin.com/d3Tmh9vK. Restarted the server
and loaded the items back in to find that they still held their
attributes.

JIRA Ticket

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