It's been a while since the latest ChatItem update, and I have to admit I'm pretty proud of it, as I didn't receive bug reports during this time so I can pretty much assume the plugin worked flawlessly.
However, a new issue has been reported this Saturday: It looks like the plugin couldn't properly handle invalid NBT Tags. For a more geeky explanation of what happened and how it was fixed, see the spoiler bellow.
Notable changes in this version:
(Hopefully) No more "Invalid Item!" errors caused by sending the client invalid tags.
Performance improvements by caching items (so they are not parsed for each packet, although they are the same)
Custom method to replace the NBTTag#toString() method (which was used until now) as it added tags regardless of their validity and didn't escape special characters
Removed debug mode, as printing messages to the same console from a series of different threads is certainly not a good idea. Besides, I hope it won't be needed again, but it might still be re-added in the future under some different form.
Config version didn't change, as I'll only be doing that when I'm modifying it's structure or adding new fields. Removing existing ones won't count as an upgrade.
Added a new list of ignored tags. Tags in that list should be ignored and not added to the item. This is to ignore tags that don't influence the way the item itself is displayed to the client and thus have no use. This mainly includes custom plugin tags, like my PortableHorses plugin's tags used for storing horse data. To add new items to that list, feel free to submit a pull request on the GitHub repository. In the future though, I might also add a method for programmatically adding items to that list, so your plugins can hook directly into mine.
The way ChatItem used to work was by sending the client the data of the item as a string. To achieve that, the plugin used reflection to get the item's NBT Tag and call the toString() method on it. However, that method did not escape special characters or ignore invalid NBT Tags. Therefore, tag keys containing values with special JSON meaning, like '['s, ']'s or '{'s, '}'s, ','s and ':'s, would fail to be properly parsed by the client, therefore the client resorting to drawing the "Invalid Item!" string instead of the proper item representation.
In this new version, I have created a new method to replace the NBTTag#toString() that ignores invalid tags and other tags specified in the list of ignored tags, and which properly escapes any special characters.